How to save a command written in CMD
By Detector | 25 July 2008
This is a short CMD tip. If you like to execute several CMD/DOS commands one by one, and you don’t like to do it manually, you should save all of these commands in one file. There are two solutions to do that:
First solution – create a file in CMD:
- Click Start – Run – type CMD, press ENTER
- In the Command prompt window write: “Copy con dos.bat” – press ENTRE
- Write CMD/DOS commands which you like to execute one by one (press Enter (new line) after every new command)
- When you are done press CTRL-Z. This will save file “dos.bat” in the folder where CMD window is open by default.
- Type dos.bat in CMD and press Enter. All CMD/DOS command will be executed immediately.
Second solution – create a file in Notepad:
- From desktop – right mouse button – choose new – text document
- Change the name of the file to “dos.bat”
- Right mouse click on the file – choose Edit
- Write CMD/DOS commands which you like to execute one by one (press Enter (new line) after every new command)
- Save the file (in this case – on the desktop)
- Double click on the file “dos.bat” will execute CMD/DOS commands one by one.
Tags | Command Prompt, Programming, Tips and Tricks, Windows
thanks :]
Excellent article. Much appreciated!