You need to enable delayed expansion if you want variables expanded at runtime. Add this line at the beginning of your script:
setlocal EnableDelayedExpansion
and replace %count%
inside loops and conditionals with !count!
.
Domanda
This is my batch script:
set vc11path=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
set path=%path%;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE
set path=%path%;%vc11path%\bin
set path=%path%;G:\ida61\flair61\bin\win
set /a "count = 1"
cd "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib"
c:
for %%i IN (*.lib) DO (
md a:\libs\%%i.fdr
)
for %%i IN (*.lib) DO (
for /F "skip=3" %%j in ('link.exe -lib /list %%i') do (
link.exe -lib /extract:%%j "%vc11path%\lib\%%i" /OUT:"a:\libs\%%i.fdr\%%~nj.n%count%.obj"
set /a "count+=1"
)
)
FOR /D %%i IN ("a:\libs\*.fdr") DO for %%j in (%%i\*.obj) do pcf.exe -g0 "%%i\%%~nj.obj"
FOR /D %%i IN ("a:\libs\*.fdr") DO sigmake %%i\*.pat a:\libs\%%~ni.sig
I'm trying to increment count
value using set /a "count+=1"
in inner loop, but it seems that this command has no effect to increment that variable.
Sorry for my poor English.
Soluzione
You need to enable delayed expansion if you want variables expanded at runtime. Add this line at the beginning of your script:
setlocal EnableDelayedExpansion
and replace %count%
inside loops and conditionals with !count!
.