Read from Text/CSV file and  run Windows Batch

jskfan
jskfan used Ask the Experts™
on
Read from Text/CSV file and  run Windows Batch

I have this command below that works just fine on One remote computer name W12.
I need it to read computer names from text or CSV file and run the code below against each computer.
Thank you
 
wmic.exe /node:w12 printer where "Name='Myprinter'" set Direct=1

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
End-user support
Commented:
FOR /f "delims=" %%G in (c:\files.csv) DO wmic.exe /node:%%G printer where "Name='Myprinter'" set Direct=1

Open in new window

Author

Commented:
it is not working

Author

Commented:
the CSV file has only names of 2 computers line up in one column.
W12
Windows7

Open in new window

Author

Commented:
Resolved.. I put wrong  path

Thank you very much for your Help

Author

Commented:
Excellent!!!

Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial