Computing.Net > Forums > Windows XP > WinXP Batch File Loop?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

WinXP Batch File Loop?

Reply to Message Icon

Name: rockman20
Date: January 19, 2005 at 06:41:55 Pacific
OS: WinXP Pro 2002 SP1
CPU/Ram: P4/1.7Ghz
Comment:

I need help with a batch file. I will shorten it and only show one of my switches, but I have a question. I was told that this batch file would loop and would probably continue to delete and rename the files on its own because the switch was never reset. Can someone give me some advice on "IF" this would happen and what I should do to stop it? Thanks in advance!

@ECHO OFF

:BEGIN
CLS
TYPE C:\SASIXP\ALLMENU.TXT
SET /P LIST= %
IF "%LIST%"=="04" GOTO AGASSIZ
IF "%LIST%"=="06" GOTO BEN
IF "%LIST%"=="05" GOTO DISCOVERY
IF "%LIST%"=="52" GOTO NORTH
IF "%LIST%"=="53" GOTO SOUTH
IF "%LIST%"=="54" GOTO WOODROW
IF "%LIST%"=="28" GOTO BENNETT
IF "%LIST%"=="23" GOTO CARL
IF "%LIST%"=="27" GOTO CENTENNIAL
IF "%LIST%"=="24" GOTO CLARA
IF "%LIST%"=="31" GOTO EAGLES
IF "%LIST%"=="22" GOTO HAWTHORNE
IF "%LIST%"=="12" GOTO HORACE
IF "%LIST%"=="21" GOTO JEFFERSON
IF "%LIST%"=="25" GOTO LEWIS
IF "%LIST%"=="26" GOTO LINCOLN
IF "%LIST%"=="18" GOTO LONGFELLOW
IF "%LIST%"=="14" GOTO MADISON
IF "%LIST%"=="17" GOTO MCKINLEY
IF "%LIST%"=="13" GOTO ROOSEVELT
IF "%LIST%"=="16" GOTO WASHINGTON
IF "%LIST%"=="44" GOTO DISTRICT
IF "%LIST%"=="333" GOTO HOME
IF "%LIST%"=="TEST" GOTO TEST
IF "%LIST%"=="test" GOTO TEST
IF "%LIST%"=="Test" GOTO TEST
IF "%LIST%"=="q" GOTO CLOSE
IF "%LIST%"=="Q" GOTO CLOSE

GOTO ERROR


:AGASSIZ
DEL /Q C:\SASIXP\RDBMS.INI
DEL /Q C:\SASIXP\SASIXP.INI
COPY /Y C:\SASIXP\RDBMS\AGASSIZRDBMS.INI C:\SASIXP
COPY /Y C:\SASIXP\SASIXPINI\AGASSIZSASIXP.INI C:\SASIXP
REN C:\SASIXP\AGASSIZRDBMS.INI RDBMS.INI
REN C:\SASIXP\AGASSIZSASIXP.INI SASIXP.INI
START /MAX C:\SASIXP\SASIXP.exe /Prefetch:1
GOTO END

:ERROR
CLS
TYPE C:\SASIXP\ERROR.TXT
PAUSE
GOTO BEGIN

:END
GOTO BEGIN

:CLOSE
EXIT



Sponsored Link
Ads by Google

Response Number 1
Name: Mark.UK
Date: January 19, 2005 at 07:24:11 Pacific
Reply:

You'll have to end the IF statement with END IF.

M


0

Response Number 2
Name: IVO
Date: January 19, 2005 at 09:25:22 Pacific
Reply:

Your script looks quite cumbersome, but it seems to be fine. I do not see any reason it enters a loop as the %LIST% variable is set to a new value by the Set /P LIST= (% is no meaning).

Mark.UK tip does not pertain to batch scripts but is aimed to BASIC code.

By the way coding If /I "%LIST%"=="string" ignores lowercase/uppercase sensitivity.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Replacement for Norton Ut... Problematic Spyware/virus



Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: WinXP Batch File Loop?

Create batch File for WinXP www.computing.net/answers/windows-xp/create-batch-file-for-winxp/110788.html

Batch file - Textfile input www.computing.net/answers/windows-xp/batch-file-textfile-input-/161986.html

Counters with FOR in Batch Files www.computing.net/answers/windows-xp/counters-with-for-in-batch-files/165116.html