DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

.bat (batch) Bacics (for Begginers)

09.29.2008
| 4487 views |
  • submit to reddit
        Batch Programming

<b>echo</b> - displays a message
<b>Example:</b>
echo Hello world
<b>Makes This:</b>
Hello world

<b>pause</b> - displays "Press any key to continue..." and stops the program until the user presses any key
<b>Example:</b>
echo Hi!
pause
<b>Makes This</b>
Hi!
Press any key to continue...
...and when the user presses a key, the program will continue on to the next line of code.

<b>cls</b> - Clears the screen.
<b>Example:</b>
echo Hi!
pause
cls
<b> Would Make:</b>
Hi!
Press any key to continue...
<b>Then....</b>
The program would clear the screen, so that there would be no text.

If you want to learn more about commands...
<b>Help</b> - Shows you all the commands. Type (any command here) /? to show help about it.
<b>Example 1:</b>
help
<b>Example 2:</b>
pause /?

Or.. Look at part 2 (<b>Coming Soon</b>)