如何使用蝙蝠脚本创建带有变音符号的文件/文件夹 [英] How do I create files/folders with diacritics using a bat script

查看:187
本文介绍了如何使用蝙蝠脚本创建带有变音符号的文件/文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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.

这是我的代码:

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

目前为止,我已使用此链接尝试过:管理具有重音字符的路径< a>

What I've tried so far using this link: Manage paths with accented characters


  1. 蝙蝠脚本是ANSI

  2. CHCP 1250> NUL

我如何解决这个问题?

推荐答案

code> CHCP XXX 进入批次,其中XXX是与您的文本文件(files.txt和folders.txt)的编码相匹配的代码页。请注意,您可以使用相当于UTF-8的 CHCP 65001 ,并且无需处理大多数的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屋!

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