I regularly find myself using this batch file template to automate tasks, so I thought I’d share it.
@ECHO off
cls
:beginning
ECHO.
echo **************** Menu *******************
echo.
echo 1 Menu Item A
echo 2 Menu Item B
echo 3 Menu Item C
echo 4 Quit without any action
set choice=
set /p choice=Your choice:
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto start
if '%choice%'=='2' goto stop
if '%choice%'=='3' goto restart
if '%choice%'=='4' goto quit
ECHO "%choice%" is not valid please try again
ECHO.
goto beginning
:start
ECHO.
ECHO Menu Item A code goes here
ECHO.
goto beginning
:stop
ECHO.
ECHO Menu Item B code goes here
ECHO.
goto beginning
:restart
ECHO.
ECHO Menu Item C code goes here
ECHO.
goto beginning
:quit
ECHO.
goto end
:end
Hey – Its good to see your blog actually containing something!
Powershell is the new Batch…..