Instructables
Picture of Comprehensive Batch Tutorial
This tutorial is for beginners through to Advanced that either want to improve their skills or learn what commands mean.
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.
 
Remove these adsRemove these ads by Signing Up

Step 1: Contents Page

Step 2: Introduction

This step will hopefully introduce you into the world of scripting (not programming) with batch.

Let's look at some basic principles of making a batch file.

Some principles:
  • 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!
Craig Bird1 year ago
Nice Instructable, clearly explained and easy to understand. I've copied the website visiter and think ill edit the code to my own websites.. thanks
Prof. Pickle (author) 1 year ago
Is there anything I missed or didn't explain properly?

Do you want any special topics such as functions (modules), files with a specific purpose and batch file maintenance?

If so ask me and I will create more sections on the topic of your choice.
for more code goto my instructable on "how to make a timer in notepad" look at the author comments
code source2 years ago
Great tutorial..
Prof. Pickle (author)  code source2 years ago
Thank you. your, and others, comments really bring a smile to my otherwise long and monotonous day.