路径中的通配符(*)在从cmd复制时不起作用 [英] Wildcard (*) in the path don't work while copying from cmd

查看:2071
本文介绍了路径中的通配符(*)在从cmd复制时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件夹中有一个文件(abc.txt)
C:\vackwrk\24may\abc.txt



,我想使用cmd-
G:\work\ p>

我使用 copy C:\vackwrk\24may\abc.txt G:\work\
这个工作,但是当我使用通配符它不工作 copy C:\vackwrk\ * \abc.txt G:\work\ 此时输出为 - 文件名,目录名或卷标语法不正确



为什么?是否有其他方法可以使用通配符复制?

解决方案

从cmd复制时没有办法使用通配符,如果有任何其他目录 C:\vackwrk\foo\ C:\vackwrk\bar\



但是Windows PowerShell允许您复制使用通配符很容易,只需要打开cmd并输入启动powershell.exe复制C:\vackwrk\ * \abc.txt G:\work\ 或者只打开Windows PowerShell并输入 PS C:\Windows \system32>复制C:\vackwrk\ * \abc.txt G:\work\



它工作正常,所以我认为Windows PowerShell比cmd更强大。


There is a file (abc.txt) in a folder- C:\vackwrk\24may\abc.txt

and i want to copy that file to another folder using cmd- G:\work\

I use copy C:\vackwrk\24may\abc.txt G:\work\ this work , but when i am using wildcard it don't work copy C:\vackwrk\*\abc.txt G:\work\ this time output is - The filename , directory name or volume label syntax is incorrect.

Why ? Is there any alternate way to copy using wildcard ?

解决方案

There is no way to use wildcard while copying from cmd because there will be ambiguity to system if there is any other directory C:\vackwrk\foo\ and C:\vackwrk\bar\,both with a file abc.txt.

But Windows PowerShell lets you to do copy using wildcard very easily , just need to open cmd and enter start powershell.exe copy C:\vackwrk\*\abc.txt G:\work\ or simply open Windows PowerShell and enter PS C:\Windows\system32> copy C:\vackwrk\*\abc.txt G:\work\ .

It works fine , so i think Windows PowerShell is more powerful than cmd.

这篇关于路径中的通配符(*)在从cmd复制时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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