Creating a batch file on windows
It is well known that creating a batch file in Linux is an easy and enjoyable task, but right now I find myself in the necessity of automating some tasks on windows so I will need to learn how to do this on windows.
In windows batch files generally have a .bat extension, so I will start by creating a file: examplebatch.bat and trying a very simple command:
1
dir
Now if I navigate to the folder where my batch file is (let’s say C:\Adrian\Batch) I can execute the batch file and the dir command will be executed:
1
2
3
4
5
6
7
8
9
10
11
12
C:\Adrian\Batch>examplebatch.bat
C:\Adrian\Batch>dir
Volume in drive C is OSDisk
Volume Serial Number is C252-78D4
Directory of C:\Adrian\Batch
04/18/2012 08:42 PM <DIR> .
04/18/2012 08:42 PM <DIR> ..
04/18/2012 08:43 PM 3 examplebatch.bat
1 File(s) 3 bytes
2 Dir(s) 186,052,022,272 bytes free