批量创建文件夹列表中:不能呼应重音符号 [英] Batch creation of a list of folders : can't echo accented characters

查看:133
本文介绍了批量创建文件夹列表中:不能呼应重音符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个批处理指令可生成不包含一个.zip文件的每个子目录的列表:

I use this batch instruction to generate a list of every subdirectory NOT containing a .zip file :

@echo off
for /d /r %%f in (*) do (
if not exist %%f\*.zip (
echo %%f >>G:\backup\folders.txt
)
)

问题是这样的生成其中口音打破返回的结果的列表,例如

The problem is this generates a list in which accents break the returned results, for instance

G:\backup\! d‚j… upload‚\

而不是

G:\backup\! déjà uploadé‚\

我读的那批​​只能在默认情况下使用UNI code字符处理。有技巧,使其吃口音路径,但我发现没有招用的口音,使之输出(回声)的结果。

I read that batch can only deal with Unicode characters by default. There are tricks to make it eat paths with an accent, but I found NO trick to make it output (echo) results with accents.

你知道该怎么做呢?我将感激不尽!

Would you know how to do that ? I'd be most grateful!

推荐答案

标准code页面的 code页850 在西欧国家在Windows非统一code控制台窗口属于贴牌code组页面。

The standard code page is code page 850 in non Unicode console windows in Western European countries on Windows which belongs to group of OEM code pages.

标准code页面在非统一$ C 的Windows 1252 在Windows西欧国家,属于ANSI code组页$ C GUI窗口虽然这code页面不是的 ANSI标准。但Windows 1252是类似于标准化的code的网页。 ISO-8859-1 与code值128(0x80的),以159的字符除外(0x9F)。

The standard code page is Windows-1252 in non Unicode GUI windows in Western European countries on Windows which belongs to group of ANSI code pages although this code page is not an ANSI standard. But Windows-1252 is similar to standardized code page ISO-8859-1 with the exception of the characters with code value 128 (0x80) to 159 (0x9F).

由于大多数的文件夹和文件名在Windows GUI应用程序创建的,以code值字符的127经常使用的是Windows 1252。

As most folder and file names are created in Windows GUI applications, characters with a code value greater 127 are often using Windows-1252.

例如文件夹名称的!似曾相识uploadé,是以字节为单位(十六进制)

For example the folder name ! déjà uploadé‚ is in bytes (hexadecimal)

21 20 64 E9 6A E0 20 75 70 6C 6F 61 64 E9 82

这些15个字节使用code页1252为显示一个字体!似曾相识uploadé,,但使用code页850为! d,Ĵ...上传

Those 15 bytes are displayed with a font using code page 1252 as ! déjà uploadé‚ but with using code page 850 as ! d‚j… upload‚'

有关此批处理文件的解决方案是输出的文件夹名称前使用命令 CHCP (其他城市code页)回声,并将其重定向到一个文本文件后来在Windows图形用户界面编辑器中打开。

The solution for this batch file is to use command chcp (change code page) before outputting the folder names with echo and redirecting them into a text file opened later in a Windows GUI editor.

@echo off
chcp 1252>nul
for /d /r %%f in (*) do (
    if not exist %%f\*.zip (
        echo %%f>>G:\backup\folders.txt
    )
)

注:没有留给&GT的空间; NUL >> G:\\备份\\ folders.txt 。有关说明见答案运行从Java批处理文件时,1随机出现之前>>

这篇关于批量创建文件夹列表中:不能呼应重音符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆