BATCH DOES NOT START

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
aquila82
Posts: 1
Joined: 16 Jun 2019 08:53

BATCH DOES NOT START

#1 Post by aquila82 » 16 Jun 2019 09:11

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

aGerman
Expert
Posts: 3629
Joined: 22 Jan 2010 18:01
Location: Germany

Re: BATCH DOES NOT START

#2 Post by aGerman » 16 Jun 2019 14:47

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

Post Reply