Skip to content

Instantly share code, notes, and snippets.

@albertgrala
Created December 13, 2012 13:26
Show Gist options
  • Save albertgrala/4276385 to your computer and use it in GitHub Desktop.
Save albertgrala/4276385 to your computer and use it in GitHub Desktop.
Windows batch files

Windows Batch Files BAT/CMD

Basics

  • The script must have the extension .bat or .cmd
  • The commands are case-insensitive. You could either use ECHO or echo

Commands

  • title set the window name for the BAT file
  • echo prints a statement
  • echo off usually the first statement, this ensures the program won't show the commands
  • pause pauses execution and outputs "press any key to continue...", once the user press a key the execution of the script continues
  • :: , rem comments the line
  • @[command] the at-sign hides the echo of a batch command

Examples

Hello World

echo off
title My first batch script
echo Hello World

Resources and links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment