I needed to pause for a varying amount of time in a batch file for a test today. Unfortunately WinXP has no built-in method of adding a time delay to a batch file. So I searched and found a commonly cited method of achieving a delay. Then I couldn’t remember how to increment a variable in a batch file, but again the answer was only a quick search away.
Putting them together I made this batch command file:
@REM Reset the target at a variable frequency starting @ 3 seconds
@REM
SET milliseconds=3000
:BEGIN
"C:Program FilesMicrochipMPLAB IDEProgrammer UtilitiesRealICERealICECMD.exe" -P18F87K22 -L
PING 1.1.1.1 -n 1 -w %milliseconds% > NUL
SET /A milliseconds=%milliseconds%+1
GOTO BEGIN
Each pass through the infinite loop adds 1 millisecond to the initial 3 second delay. To stop the batch file simply press Ctrl+C.