Use the Command Prompt and Write in Batch Language

To start you are going to need to have two programs open. One of them is notepad. You can access it by clicking Start > Run... > notepad. Minimize that and open the command prompt. You can access that at Start > Run... > cmd.

Steps

  1. Know about these two pieces of software. Notepad isn’t any text-editing program because when you save it you can add any extension. Command prompt or CMD is like DOS but it has loads more functionality. So at the command prompt to make things easier to use you need to right click at the blue bar at the top and select properties. Under the tab options you need to make sure QuickEdit Mode is enabled. Click OK. A box will appear to say if you want to apply them or save them. Click on the box saying ‘Save properties for future windows with the same title’. Click OK.
  2. Learn about what it can do. You might think at this point that it is going to ruin my system. It can if you have no idea what you are doing. So to start, you need to know how to navigate between directories. Type ‘CD c:\’ then hit enter. You will have noticed that you have gone from your documents and settings directory to your C drive's root directory. If you follow the following instructions, you are going to see every file and folder that is in that directory. Type ‘DIR’ and hit enter. Now you should see a long list. The rows of text in the last column tells you the names of the directories branching from the root directory (the top) of your C drive or in any other case, the directory you are currently in. If it is a folder, you will see.
  3. <dir>" in the column left of the name column in the same row. If it is as file it will not have "<dir>" next to it and will have a file extension (*.txt, *.exe, *.docx) at the end of the name.</li>
  4. Make a directory to put all the batch files you are going to be making. Type ‘MKDIR mybatch’. You just ordered windows to make a new directory or folder called mybatch. If you want proof it is there type ‘DIR’ again and look around. You should see it as a DIR.
  5. Learn how to use the ping command. If you don’t have Internet connection you can skip this part but if you do you need to know it. Ping means to send packets of data around a website and it to return back to you. If it does it means the website is working and is alive. So we are going to test the well known website Google search engine so you are going to type ‘PING Google.com’ then hit enter. You should see something saying like ‘Reply from 72.14.207.99: bytes=32 time=117ms TTL=234.’ It might have this about four times. If it says that it cannot ping your Internet connection isn’t working or the website is dead. It will also say how many packets it sent, received and lost. If it lost 0 the website is working 100%.
  6. Opening a program from the windows directory and system32 is easy. Just type something like mspaint.exe and it will open the paint program. It is harder to open a program within a directory and you already did this using the user interface when you opened command prompt and notepad earlier. The way to open a file or program from inside a directory is harder. Assuming you still have notepad open type ‘hello world.’ Then click file>save as>helloworld.txt in mybatch folder in your c directory. Now reopen command prompt and you will be in your documents and setting folder. Now type ‘cd c:\mybatch’ hit enter and then type helloworld.txt .You will not normally need to open command prompt again but it makes it a little bit more challenging because you don’t normally start in the C directory.
  7. Make a DIR called delete me in your c directory. To delete a directory you need to use the RMDIR command. For example, 'RMDIR deleteme' basically means "delete the directory named 'deleteme'". even though the command is RMDIR it will work with files as well as sub-directories or folders. A little tip: when using the RMDIR command, navigate to the directory that contains the file or sub-directory you would like to delete, and then type 'RMDIR *' with * being the name of the file or sub-directory you want to delete. navigate to the C drive then type ‘RMDIR deleteme.’ Then it will ask if you are sure you want to delete the directory. Type Y for yes and then hit enter. You have just deleted the folder called delete me.
  8. Rename a file or folder. You can use any of these two commands they are both exactly the same, REN and RENAME so make a directory called idon’tlikemyname then type ‘REN idon’tlikemyname mynameisgood.’ You have just renamed the directory. Now you can delete it.
  9. Learn about batch programming and do it in notepad. You do not need to buy expensive software for something you can do for free. In notepad type:
  10. You have just told it to echo three sentences. This is writing that will be shown on the screen. @echo off means that you won’t see on the screen the commands because if you did it would say:
  11. The command time /t tells you the time! You must put "/t" or it will want you to change the time.
  12. Go to file>save as>(save it in your mybatch folder) called Timefirst.bat. Notice that is has been saved as a bat file and not text. Don’t get confused and called it Timefirst.batch because it will not work.
  13. </ol>

Tips

  • There are other commands to the ones listed, so just type help to learn more.

Warnings

  • When using del (or delete) to delete files, be aware that they are permanently removed from the computer without ever going into the trashcan and cannot be recovered.
  • If you don't know what you are doing you can seriously mess up your machine.

Related Articles