In this tutorial you will:
• Learn how to make a batch file
• Learn how to do basic commands
• Learn how to use the IF command properly
• Learn how to use variables and ask questions
• Understand how batch files work
If you are looking for “viruses” then look elsewhere.
My goal for this instructable is to make it one of the biggest, most comprehensive and most reliable batch instructables out there.
Step 2: Introduction
Let's look at some basic principles of making a batch file.
- Batch files have the extension of ".bat". That isn't the only extension that can be used however, you won't learn them here (probably).
- You can create a batch file with most text editors (such as notepad). I use Notepad++, but you can use anything you like.
- The commands that a batch file uses are read top to bottom, left to right.
- Commands can be written in UPPERCASE or lowercase. It doesn't really matter. PAuSe will be interpreted the same way as PAUSE or pause.
Some things you should know about this tutorial:
- Any code that I use (including command names) will be in italics.
- Any code that you will need to replace (such as a file path) will be in bold-italics.
- Any output from code that I've written will be in italic-subscript.
- The script snippets that I write (that I say to test out) are probably best if you type them into the command prompt (cmd.exe).
Some background information...
- When naming a script, save it as name.bat.
- The command prompt can be found at "C:\Windows\System32\cmd.exe" while notepad can be found at "C:\Windows\System32\notepad.exe".
- It's not necessary, but you could make a folder in your C drive named "Batch" for all your scripts (so they are easily accessible).
So, let's begin out batch journey!