Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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 30SET /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.

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

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.

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

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