windows 在批处理文件中使用通配符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7950352/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:22:34  来源:igfitidea点击:

Use of wildcard characters in batch file

windowsbatch-filewildcard

提问by Darzen

I need to copy some files from one folder to another using batch file.

我需要使用批处理文件将一些文件从一个文件夹复制到另一个文件夹。

The source folder has a registered symbol ( R with a circle around it) in its name. I dont have the rights to rename the folder but I need to trace to the source folder and copy the files in it.

源文件夹的名称中有一个注册符号(R 周围有一个圆圈)。我没有重命名文件夹的权限,但我需要跟踪到源文件夹并复制其中的文件。

I tried to use the characters . ? and * which works when I directly run it on command prompt. But when I use it in the batch file, it searches for the file with that character in the name

我尝试使用字符。? 和 * 当我在命令提示符下直接运行它时有效。但是当我在批处理文件中使用它时,它会搜索名称中包含该字符的文件

Please let me know how I can reproduce the registered symbol using keyboard and how I can use wildcards to find the folder name.

请让我知道如何使用键盘重现注册符号以及如何使用通配符查找文件夹名称。

Thanks

谢谢

回答by Brent Arias

It sounds like you have quotation marks around the file name in your batch file. Remove the quotation marks, and it should then expand properly.

听起来您的批处理文件中的文件名周围有引号。删除引号,然后它应该可以正确展开。

Also, you should modify your question to show exactly what your copy command looks like in your batch file. It would significantly help myself and others to determine a solution.

此外,您应该修改您的问题以准确显示您的复制命令在您的批处理文件中的样子。这将极大地帮助我自己和其他人确定解决方案。

回答by Aacini

The ? (Registered Mark) is the character number 174 (at least, in Lucida console, the standard font in Windows). You may directly enter it via the keyboard with Alt-174 (in numeric keypad) keystrokes. If this not works, you may copy if from the Character Map accessory and then paste it in any place you wish.

这 ?(Registered Mark) 是字符号 174(至少,在 Lucida 控制台中,Windows 中的标准字体)。您可以使用 Alt-174(在数字小键盘中)按键直接通过键盘输入它。如果这不起作用,您可以从 Character Map 附件中复制 if,然后将其粘贴到您希望的任何位置。

C:\Documents and Settings\Antonio
>echo Character pasted from Character Map: ?
Character pasted from Character Map: ?