batch-file Getting started with batch-file Editing and Viewing Batch Files


Any ASCII editor can edit batch files. A list of editors that can syntax highlight batch syntax can be found here. You can also use the default notepad shipped with windows to edit and view a batch file, although it does not offer syntax highlighting.

To open notepad:

  • Press Win 𐌎+R, type notepad and then press Enter.

Alternatively, the most "primitive" way to create a batch file is to redirect output from the command line to a file, eg.

echo echo hello world > first.bat

which writes echo hello world to the file first.bat.

You can edit a batch file by right clicking the file and selecting "Edit" from the context menu.

To view the contents of a batch file from within a command prompt, run the following command:

type first.bat

You can also start editing your batch file with notepad from the command prompt by typing

notepad first.bat