Creating Batch File Using Notepad

Courtesy from Wikipedia: Batch File icon in Windows Vista

A batch file is a kind of script file in DOS, OS/2 and Windows. It consists of a series of commands to be executed by the command line interpreter, stored in a plain text file.

Filename extension: .bat, .cmd, .btm
Internet media type: application/bat, application/x-bat, application/x-msdos-program, text/plain
Type of format: Scripting
Container for: Scripts

Source: Wikipedia

INTROIT Class Excercise

INTROIT Class Exercise, August 31, 2016 – Creating a batch file

Creating a batch file?
1. Launch CMD. Press the WIN key + R (Windows XP to present) then type CMD.

Win key + R (image from www.unr.edu)

Win key + R (image from http://www.unr.edu)

run CMD

run CMD

2. Make or create a directory. MD [LASTNAME], press Enter.

3. Display directory. DIR/OD, press Enter.

4. Change directory. CD [LASTNAME], press Enter.

Make, display and change directory

Make, display and change directory

5. Create batch file ACC.BAT. Creating a batch file in Windows XP is just by typing EDIT ACC.BAT. But that is not the case in higher Windows versions, say Windows 8.1, we have to use the Notepad. Instead the EDIT command, we launch Notepad: notepad.exe acc.bat.

Launch Notepad in CMD

Launch Notepad in CMD

Notepad creating acc.bat

Notepad creating acc.bat

Using selected ASCII codes for the exercise:

ALT 176
ALT 185
ALT 186
ALT 187
ALT 188
ALT 200
ALT 201
ALT 202
ALT 203
ALT 204
ALT 205
ALT 222
ALT 223

6. Save the file by pressing CTRL -S.

Saving the batch file

Saving the batch file

Save as .bat and Unicode for the Encoding option

Save as .bat and Unicode for the Encoding option

7. Run the batch file to display the output.

Batch file displayed

Batch file displayed from notepad, not as we expected

Cheers.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s