@echo off :: Author: Robert Lie (mobilefish.com) :: :: This batch file displays a message :: Usage 1: display.bat -1 :: Usage 2: display.bat -2 test :: init variable :: Do not put a space before or after the = set msg1=hello if "%1"=="-1" set display=%msg1% if "%1"=="-1" goto print if "%1"=="-2" set display=%2 if "%1"=="-2" goto print echo Usage error echo unrecognized arg '%1' goto done :print echo Message = %display% :done