I am new to all of this, it took me some hours to make the following:
@ECHO OFF
CLS
ECHO===========================================================================
ECHO MENU
ECHO===========================================================================
ECHO...........................................................................
ECHO Type 1,2 or 3 then press ENTER:
ECHO...........................................................................
ECHO.
ECHO 1 - SERVER XXX.XXX.XXX.1
ECHO 2 - SERVER XXX.XXX.XXX.2
ECHO 3 - EXIT
ECHO.
SET /P OPT=Type 1,2 or 3 then press ENTER:
IF %OPT%==1 GOTO MSTSC 1
IF %OPT%==2 GOTO MSTSC 2
IF %OPT%==3 GOTO EOF
:MSTSC 1
mstsc.exe /v:XXX.XXX.XXX.1 /admin /F
GOTO EOF
:MSTSC 2
mstsc.exe /v:XXX.XXX.XXX.2 /admin /F
GOTO EOF
:EOF
EXIT
When I select options 1 and 3 they work fine, when I select option 2 I get the same result as option 1. It's not connecting the second server, how can this be fixed? Also how can I have the command prompt close as soon as the command is executed? The command prompt closes only after I close MSTSC.
Thank you all.
Also since this is my first attempt at a batch file please tell me of all the mistakes so I can learn.