I am setting a number of variables using the for /f
command.
setlocal ENABLEDELAYEDEXPANSION set vidx=0 for /F "tokens=*" %%A in (target_list.txt) do ( SET /A vidx=!vidx! + 1 SET var!vidx!=%%A ) set var
Now that I have set them I need to be able to be able recall them in a loop and apply them to the following commands.
copy gateway%num%.bat \\%var1%\C$\WINDOWS\system32 psexec \\%var1%\ gateway%num%.bat del \\%var1%\\C$\WINDOWS\system32\gateway%num%.bat
The reason I need them in a loop is because the number of variables will change periodically and I need it to be able to figure out how many it made in the previous command and then apply them in the second command. I don't want to have to copy this command over and over and only change (var1
) to (var2
) to (var3
) etc.