Batch file problem in windows

ml41782

Distinguished
Mar 17, 2011
3
0
18,510
Hello,
I'm trying to increment a number in a batch file and I'm sure its something simple. The counter wont increment. I get the same number in every file.

rem stage 02
rem
set /a counter=20213
echo %counter% begin >>Mikey.txt
rem
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
for /F "tokens=1" %%c in (File.card2) do (
@echo.|set /p="cscript.exe wmcmd.vbs -vdevice ">%%c.bat
findstr /i "Video" %%c > %%c.av
for /F "tokens=1-4" %%f in (%%c.av) do @echo.|set /p="%%f " >>%%c.bat
@echo.|set /p=" -adevice " >>%%c.bat
findstr /i "Audio" %%c > %%c.aa
for /F "tokens=1-4" %%d in (%%c.aa) do @echo.|set /p="%%d " >> %%c.bat
@echo.|set /p=" -maxpacket 1400 -author %%c -description %%c -broadcast %counter% ">> %%c.bat
@echo.|set /p=" -loadprofile f4.prx -duration 86400 ">>%%c.bat
set /a counter=%counter%+1)
del /q *.aa
del /q *.av
del /q *.card
endlocal
 

ml41782

Distinguished
Mar 17, 2011
3
0
18,510
I was on the right track and I found the error of my ways.


rem stage 02
rem
set /a counter=20213
echo %counter% begin >>Mikey.txt
rem
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
for /F "tokens=1" %%c in (File.card2) do (
set /a counter+=1
@echo.|set /p="cscript.exe wmcmd.vbs -vdevice ">%%c.bat
findstr /i "Video" %%c > %%c.av
for /F "tokens=1-4" %%f in (%%c.av) do @echo.|set /p="%%f " >>%%c.bat
@echo.|set /p=" -adevice " >>%%c.bat
findstr /i "Audio" %%c > %%c.aa
for /F "tokens=1-4" %%d in (%%c.aa) do @echo.|set /p="%%d " >> %%c.bat
@echo.|set /p=" -maxpacket 1400 -author %%c -description %%c -broadcast !counter! ">> %%c.bat
@echo.|set /p=" -loadprofile f4.prx -duration 86400 ">>%%c.bat)
del /q *.aa
del /q *.av
del /q *.card
endlocal