英文:
Windows Command Prompt, how to move folder?
问题
以下是您要翻译的部分:
"我有一个关于Windows命令提示符的问题。我尝试创建一个包含用于创建以当前日期命名的文件夹、创建一些文件并最终将文件夹移动到不同位置的简单命令的cmd文件。出于某些原因,最后一部分没有正常工作。以下是我的代码:
cd Desktop
mkdir "%DATE%"
cd "%DATE%"
echo new > index.html
echo new > main.js
echo new > style.css
//move "%DATE%" MeineProjekte <---- 这是问题所在。希望有人能帮助我解决这个问题。如果您有更好的显示此代码的方式,我也会感激不尽。
我尝试过在谷歌上寻找解决方案,但没有太多好运。"
英文:
I have a question regarding windows command prompt. I tried to create a cmd file containing simple commands for the use of creating a folder named after the current date , have it create some files and finaly move the folder to a diffrent location. For some reasons the last part is not working right. Here is my code
cd Desktop
mkdir "%DATE%"
cd "%DATE%"
echo new > index.html
echo new > main.js
echo new > style.css
//move "%DATE%" MeineProjekte <---- thats the problem. Hope someone could help me on this.
And if you have any better ways of displaying this code I would appreciate this aswell
I tried to google for a solution and had not mutch luck.
答案1
得分: 0
After using the CD
command, you changed the directory. If your MeineProjekte
folder is not located inside the %DATE%
folder, you can not move %DATE%
there.
I assume that you should use cd ..
after echo
commands. Something like this:
cd Desktop
mkdir "%DATE%"
cd "%DATE%"
echo new > index.html
echo new > main.js
echo new > style.css
cd ..
move "%DATE%" MeineProjekte
It will work only if MeineProjekte is in the scope. If not, you should specify the absolute path to this folder (e.g. C:\MeineProjekte
if it is on your C disk).
英文:
After using CD
command, you changed the directory. If your MeineProjekte
folder is not located inside the %DATE%
folder, you can not move %DATE%
there.
I assume that you should use cd ..
after echo
commands. Something like this:
cd Desktop
mkdir "%DATE%"
cd "%DATE%"
echo new > index.html
echo new > main.js
echo new > style.css
cd ..
move "%DATE%" MeineProjekte
It will work only if MeineProjekte is in the scope. If not, you should specify the absolute path to this folder (e.g. C:\MeineProjekte
if it is on your C disk).
答案2
得分: 0
我相信你的计算机不知道你是在谈论目标文件还是目录。
你可以尝试以下操作:
move "%DATE%"\ MeineProjekte
(反斜杠清楚地表示%DATE%
是一个目录。)
英文:
I believe your computer does not know if you're talking about a destination file or directory.
You might try the following:
move "%DATE%"\ MeineProjekte
(The backslash says clearly that %DATE%
is a directory.)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论