XCOPY不支持特殊字符! [英] XCOPY not supporting special characters!

查看:209
本文介绍了XCOPY不支持特殊字符!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件,而我使用xcopy

我给它一个任务,就是从列表中复制文件

文件,但文件夹和文件的名称带有特殊字符

就像áéíóú...这样,如果我执行复制名称为creemebrule.jpg的文件,它就可以工作,但是如果我告诉我复制creemebrulé.jpg,它就不会做,它总是说找不到文件" ,所以我确实发现xcopy不支持非常规字符...

我无法弄清楚文件和文件夹的名称,因为它们被设置为读取纹理,并且必须以这种方式被读取,所以这是我的批处理文件:

@echo关闭
/f(文件列表.txt)中的" delims ="%% i"会回显F | xcopy"c:\ %% i""c:\ prueba2 %% i"/i/z/y

这是我的filelist.txt文件的内容:

\ prueba \ foto \ naranjas.rar
\ prueba \ foto2 \ naranjas4.rar
\ prueba \célular\célulargenial.bmp(注意:这是由于字符é"而失败的)


我一直在到处寻找解决方案,我发现了代码,我只需要特殊字符的支持,这使我陷入了困境:/

i have a batchfile and i''m using xcopy

i''m giving it a task to do, is copying files from a list

of files, but the name of the folders and files have special characters

like áéíóú... so if i execute to copy a file that has the name of creemebrule.jpg it works, but if i tell to copy creemebrulé.jpg it wont do it, it keeps saying that "file not found" when is there, so i did find out that xcopy does not support characters that are not regular...

i can''t be screwing around with the name of the files and folders because they are set to be read for texture and are required the way the are, so this is my batch file:

@echo off
for /f "delims=" %%i in (filelist.txt) do echo F|xcopy "c:\%%i" "c:\prueba2%%i" /i /z /y

and this is the content of my filelist.txt file:

\prueba\foto\naranjas.rar
\prueba\foto2\naranjas4.rar
\prueba\célular\célulargenial.bmp (note: this is the one that fails because of the char "é")


i''ve been looking for a solution everywhere and i found the code, i just need support for special characters, is putting me in the ground :/

推荐答案

有趣东西.首先,我不知道特殊字符"之类的东西.有什么特别的?这个字符没有什么特殊的",甚至不是Unicode,只是ANSI的上半部分.有趣的是,它是使用CMD.EXE shell从复制"命令复制的,只有批处理文件不支持它. (顺便说一下,CMD.EXE应用程序可以使用Unicode,为此需要一个命令行参数.)但是批处理文件将此字符解释为"8".

批处理文件非常老,但是它们在NT中进行了重新处理(甚至支持功能,并且使用了基本语法),但是关于文件命名的某些过时功能"可能未得到修复.我认为您对此无能为力.

—SA
Funny stuff. First, I don''t know such thing as "special character". Special for what? There is nothing "special" about this character, this is not even Unicode, just upper half of ANSI. What''s funny, it''s copied from the "copy" command using CMD.EXE shell, only batch file does not support it. (By the way, CMD.EXE application can work with Unicode, needs a command line parameter for that.) But batch file interpret this character as ''8''.

Batch files are very old but they were re-worked in NT (even supports functions, in a rudimentary syntax), but perhaps some obsolescent "features" about file naming were not fixed. I don''t think you can do anything about it.

—SA


您是一名程序员-编写一个自己的控制台应用程序,该程序需要两个参数-源文件和目标文件-并使用File复制以复制文件.

从批处理文件而不是xcopy调用控制台应用程序.

这不是火箭手术.
You''re a programmer - write yourself a little console application program that takes two parameters - a source file and a target file - and use File.Copy to copy the file.

Call your console app from the batch file instead of xcopy.

It ain''t rocket surgery.


这篇关于XCOPY不支持特殊字符!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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