将文件移动到CMD中的父文件夹

equ*_*ion 1 windows cmd dos move batch-file

我需要进行健全检查.我记得能够运行这样的命令:

C:\TestFolder> move *.* ..
Run Code Online (Sandbox Code Playgroud)

这应该将当前文件夹中的所有文件移动到一个文件夹,即.到了父母.

现在运行此命令,在Windows 10命令提示符下,我收到以下错误:

The filename, directory name, or volume label syntax is incorrect. 
Run Code Online (Sandbox Code Playgroud)

我在StackOverflow上看了很多类似的问题.大多数答案都说需要一些复杂的循环命令才能将文件移动到父级.那些提到move *.* ..有些人说这个命令适合他们,而其他人报告我得到的同样的错误.

一个例子:https://stackoverflow.com/a/25542277/2066896(展开所有评论以查看相关交换)

当然,我多年来都不需要使用这个命令,因此在Windows最近的历史中某些时候可能会删除对move命令中".."符号的支持.或许它永远不存在,我只是在做梦.

只是想知道是否有人可以解决这个问题.谢谢!

Jos*_*efZ 7

如果没有任何动作,则会出现错误,请参阅下面的示例.尝试

move *.* .. 2>NUL
Run Code Online (Sandbox Code Playgroud)

示例:

D:\test\a folder\with spaces>move *.* ..
D:\test\a folder\with spaces\New Text Document (2).txt
D:\test\a folder\with spaces\New Text Document.txt
        2 file(s) moved.

D:\test\a folder\with spaces>move *.* ..
The filename, directory name or volume label syntax is incorrect.

D:\test\a folder\with spaces>move *.* .. 2>NUL

D:\test\a folder\with spaces>
Run Code Online (Sandbox Code Playgroud)