Page 1 of 1

BATCH DOES NOT START

Posted: 16 Jun 2019 09:11
by aquila82
HI AT ALL.
When I launching un batch it doesn't start.
When i take same string command in this batch and do copy and paste in prompt cmd it start.

Why?

Command is:

for /l %a in (1,1,10) do (echo 192.168.0.%a & psexec \\192.168.0.%a -u administrator -p prova wmic csproduct get name) >>c:\nomimacchina
This string if I launch in promt manually it start but if I save it in file .bat the windows open and disappears quickly without start.

I hope in answer

Re: BATCH DOES NOT START

Posted: 16 Jun 2019 14:47
by aGerman
In a command line FOR variables have one preceding percent sign (e.g. %a) while in a Batch script they need to have two (e.g. %%a).

Steffen