我如何使用蝙蝠脚本创建具有变音符号文件/文件夹 [英] How do I create files/folders with diacritics using a bat script
本文介绍了我如何使用蝙蝠脚本创建具有变音符号文件/文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有读取行的文件,然后一个bat文件试图创建文件或文件夹,根据给定的参数。
I have a bat file that reads the lines a file, and then tries to create files or folders, depending on the given argument.
的问题是,当它到达字符作为ăâţîş,这是行不通的。
The problem is that when it gets to chars as ăâțîș, it does not work.
这是我的code:
IF "%1"=="" GOTO Final
IF "%1"=="file" GOTO File
IF "%1"=="folder" GOTO Folder
:File
for /f %%i in (files.txt) do echo. > %%i.rtf
GOTO Final
:Folder
for /f "tokens=*" %%a in (folders.txt) do (
mkdir "%%a"
)
GOTO Final
:Final
我到目前为止已经试过使用此链接:管理与重音字符路径
- 蝙蝠脚本是ANSI
- CHCP 1250> NUL
我怎样才能解决呢?
推荐答案
将 CHCP XXX
到批处理其中XXX是codePAGE匹配您的文字编码文件(files.txt和folders.txt)。请注意,您可以使用 CHCP 65001
这相当于UTF-8,并应处理大多数diactrics的没有问题。
Put CHCP XXX
into the batch where XXX is a codepage that matches encoding of your text files (files.txt and folders.txt). Note that you can use CHCP 65001
which is equivalent of UTF-8 and should handle most of diactrics without problems.
这篇关于我如何使用蝙蝠脚本创建具有变音符号文件/文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文