Parameter issue using the SHIFT command

September 9, 2010 at 12:44:59
Specs: Windows XP
I have a dos script below where i need to add more than nine parameters (all added as parameters within a scheduler), i added SHIFTS in to add the 10th variable and now my
loopcount comes back as

set /A LoopCount+=1
The syntax of the command is incorrect.

If i remove the SHIFTS my loopcount works OK. I assume the SHIFTS are affecting
the set /a in my loopcount. I have also tried with a different syntax of set /A
LoopCount=%LoopCount% +1 with the same results. The issue only occurs after the 9th shift is added, up until then the loopback still works. Any help greatly appeciated.

SET NumberOfFiles=%2
SET MoveSumLog=C:\Jobs\Logs\%1_Summary.log
SET MoveSumMsg=""
SET SourceFile1=%3
SET SourceFile2=%5
SET SourceFile3=%7
SET SourceFile4=%9
SET CMJOB=%1
SET Destination1=%4
SET Destination2=%6
SET Destination3=%8
SHIFT
SHIFT
SHIFT
SHIFT
SHIFT
SHIFT
SHIFT
SHIFT
SHIFT
SET Destination4=%1
SET /A LoopCount=0

:CheckLoop
Set /A LoopCount+=1
If %LoopCount% GTR %2 (
Goto :All-OK
) Else (
Goto :MoveFile%LoopCount%
)


See More: Parameter issue using the SHIFT command

Report •


#1
September 9, 2010 at 12:54:12
Replace:
If %LoopCount% GTR %2 (
With:
If %LoopCount% GTR %NumberOfFiles% (


Report •

#2
September 14, 2010 at 08:00:36
Thanks a lot, that sorted it. Should've spotted that one. Cheers

Report •

Related Solutions


Ask Question