Computing.Net > Forums > Windows 2000 > DOS looping problem

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.

DOS looping problem

Reply to Message Icon

Name: trishah
Date: February 28, 2006 at 03:45:36 Pacific
OS: Windows 2000
CPU/Ram: Intel P4 1GB RAM
Product: Dell
Comment:

Hello,

I've a DOS problem. I'm trying to run a perl script from inside a batch file:

@ECHO OFF
SET COUNT=1

:LOOP

echo Loop number %COUNT%

IF %COUNT% == %1% GOTO END

echo running perl script to update static data in newSegment.xml %COUNT%
START C:\updateXMLSourceFile.pl %COUNT%
call wait 30

SET /A COUNT=COUNT+1

GOTO LOOP

:END

I want to increment the value passed into updateXMLSourceFile.pl each time the loop goes round.

The problem is that the value passed into the perl script never seems to increment.

Can anyone suggest something please ?

Thanks,

Trish.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: February 28, 2006 at 06:24:48 Pacific
Reply:

Hi Trish,

If this:

IF %COUNT% == %1% GOTO END

is intended to compare the count to a command line parameter, I think you need:

IF %COUNT% == %1 GOTO END


==========
This:

SET /A COUNT=COUNT+1

should be:

SET /A COUNT=%COUNT%+1

or, more simply:

set /a COUNT+=1


to increment it.

====
And probably a good idea to use set/a when you initialize COUNT.


If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: trishah
Date: February 28, 2006 at 08:54:38 Pacific
Reply:

Thank you for replying to my post,

All help greatly appreciated.

I discovered after writing the post that there where 2 things preventing the batch file from running the perl script.

First of all I needed to include the word perl in the START command.

Then the perl script was only being called if the perl script was in the same folder as the batch script. So the START line becomes:
START perl updateXMLSourceFile.pl %COUNT%

Thanks again,
Trish.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: DOS looping problem

DOS program problem in Win 2k www.computing.net/answers/windows-2000/dos-program-problem-in-win-2k/12718.html

Windows 2000 DOS memory problems www.computing.net/answers/windows-2000/windows-2000-dos-memory-problems/57083.html

BATCH FILE: loop inside a for loop www.computing.net/answers/windows-2000/batch-file-loop-inside-a-for-loop/65112.html