Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to make a batch file to run a different set of commands depending on a the location of the office they're in. I'd like to have the user tell the system where they are and then have the system to go a series of commands based on their answer. I have the following started;
@ ECHO OFF
ECHO Select your office from the list...
ECHO 1.WEATHERFORD
ECHO 2.DALLAS
ECHO 3.FT.WORTHSTART C:\WINDOWS\SYSTEM32\CHOICE.exe /C:123
IF ERRORLEVEL 1 GOTO WEATHERFORD
IF ERRORLEVEL 2 GOTO DALLAS
IF ERRORLEVEL 3 GOTO FTW:WEATHERFORD
ECHO YOU ARE IN WEATHERFORD
PAUSE
GOTO END
:DALLAS
ECHO YOU ARE IN DALLAS
PAUSE
GOTO END:FTW
ECHO YOU ARE IN FT. WORTH
PAUSE
GOTO END:END
ECHO VAYA CON DIOS
PAUSEHowever, no matter what is input, it always says 'You are in Weatherford'. Can anyone help me with this?!?!?! I would be incredibly grateful!!!
Dan W.

IF ERRORLEVEL 1
means 1 *OR MORE* so you always wind up on weatherford.
::==better
@echo off
setLocal EnableDelayedExpansionECHO Select your office from the list...
ECHO 1.WEATHERFORD
ECHO 2.DALLAS
ECHO 3.FT.WORTHCHOICE /C:123
goto %ERRORLEVEL%
:1
ECHO YOU ARE IN WEATHERFORD
PAUSE
GOTO END
:2
ECHO YOU ARE IN DALLAS
PAUSE
GOTO END:3
ECHO YOU ARE IN FT. WORTH
PAUSE
GOTO END:END
ECHO VAYA CON DIOS
PAUSE
::==
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |