windows 命令提示符:当我将文件夹(包含内容)从桌面移动到新目录时,为什么会出现“找不到指定的路径”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5606398/
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-09 08:15:41  来源:igfitidea点击:

Command Prompt: Why do I get “cannot find the path specified” when I move a folder (with contents) from the desktop to a new directory?

windowscmdcommand-prompt

提问by nicky

move C:\%USERNAME%\Desktop\TZClock C:\%USERNAME%\Start Menu\Programs\TZClock

I keep getting system cannot find the path specified. But I can navigate to it. Does MOVEonly work on files?

我一直让系统找不到指定的路径。但我可以导航到它。是否MOVE只对文件的工作?

回答by Jollymorphic

Under Windows XP, it would be thus:

在 Windows XP 下,它会是这样:

move "c:\documents and settings\%USERNAME%\desktop\TZClock" "C:\documents and settings\%USERNAME%\Start Menu\Programs\TZClock"

On Windows 7, it is the following (though I'm not in a position to test this right now):

在 Windows 7 上,它如下(虽然我现在无法测试):

move "c:\users\%USERNAME%\desktop\TZClock" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\TZClock"

回答by gringo_dave

If you want to move more than one directory using wildcard, you can use FOR /Dcommand. Type this in command-line (don't forget to replace _source_dirs_ and _destination_dir_ with your directories):

如果要使用通配符移动多个目录,可以使用FOR /D命令。在命令行中输入(不要忘记用你的目录替换 _source_dirs_ 和 _destination_dir_):

FOR /D %p IN ("_source_dirs_*") DO MOVE %p _destination_dir_

回答by nicky

Got It! My syntax was wrong: the space was blocking the command from running. Also, I did not have User specified in the path.

知道了!我的语法错误:空间阻止命令运行。另外,我没有在路径中指定用户。

After changes:

更改后:

move C:\Users\%USERNAME%\Desktop\TZClock C:\Users\%USERNAME%\"Start Menu"\Programs\