Windows Command Prompt,如何移动文件夹?

huangapple go评论60阅读模式
英文:

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 &quot;%DATE%&quot;
cd &quot;%DATE%&quot;
echo new &gt; index.html
echo new &gt; main.js
echo new &gt; 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 &quot;%DATE%&quot;
cd &quot;%DATE%&quot;
echo new &gt; index.html
echo new &gt; main.js
echo new &gt; style.css
cd ..
move &quot;%DATE%&quot; 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 &quot;%DATE%&quot;\ 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 &quot;%DATE%&quot;\ MeineProjekte

(The backslash says clearly that %DATE% is a directory.)

huangapple
  • 本文由 发表于 2023年2月6日 17:15:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359351.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定