Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Windows Command Prompt, how to move folder?

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

After using CD command you changed the directory. If your MeineProjekte folder located not inside the %DATE% folder, you can not move %DATE% there. I assume that you should use cd .. after echo commands. Something like that:

cd Desktop
mkdir "%DATE%"
cd "%DATE%"
echo new > index.html
echo new > main.js
echo new > style.css
cd ..
move "%DATE%" MeineProjekte

It will works only if MeineProjekte is in the scope. In opposite case you should specify absolute path to this folder (e.g. C:\MeineProjekte if it is on your C disk).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading