简体   繁体   English

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

[英]Move files to parent folder in CMD

I need a sanity check. 我需要进行健康检查。 I remember being able to run a command like this: 我记得能够运行这样的命令:

C:\TestFolder> move *.* ..

This should move all files in the current folder up one folder, ie. 这应该将当前文件夹中的所有文件上移一个文件夹,即。 to the parent. 给父母

Running this now, in a Windows 10 command prompt, I get the following error: 现在运行此命令,在Windows 10命令提示符下,出现以下错误:

The filename, directory name, or volume label syntax is incorrect. 

I've looked through a bunch of similar questions at StackOverflow. 我在StackOverflow浏览了很多类似的问题。 Most answers say that some complex loop command is required to move files to the parent. 大多数答案都说,需要一些复杂的循环命令才能将文件移动到父级。 Those that mention move *.* .. have some people saying this command works for them, while others report the same error I'm getting. 那些提到move *.* ..人有些人说此命令对他们有用,而其他人则报告了我遇到的相同错误。

One example: https://stackoverflow.com/a/25542277/2066896 (expand all comments to see the relevant exchange) 一个示例: https : //stackoverflow.com/a/25542277/2066896 (展开所有评论以查看相关交流)

Granted, I haven't needed to use this command in years, so perhaps support for the ".." notation in the move command was removed at some point in Windows' recent history. 当然,多年以来我都不需要使用此命令,因此也许在Windows的最近历史中的某个时候,已经删除了对move命令中“ ..”符号的支持。 Or perhaps it was never there, and I'm just dreaming. 也许它从未出现过,而我只是在做梦。

Just wondering if someone can clear this up. 只是想知道是否有人可以解决此问题。 Thanks! 谢谢!

The error appears if there is nothing to move, see an example below. 如果没有要移动的内容,则会出现错误,请参见下面的示例。 Try 尝试

move *.* .. 2>NUL

Example : 范例

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM