Looping Net Use Batch File - TechRepublic
Question
June 26, 2009 at 01:29 PM
batz281

Looping Net Use Batch File

by batz281 . Updated 17 years ago

Hello everyone,

I would like to find out if it is possible to loop through a series of networked computers, access their drive through netuse, xcopy a file, and then release the share.

I wrote a working batch file that will do it one PC at a time, but being able to loop would be a huge help.

Here’s what I envision, please let me know how to do it properly, if it’s possible:

For each i = 1 to 20
net use x: \\PC i\c$
xcopy x:\users\file\* z:\Temp\PC i /y
net use x: /delete
Next

Is it possible to append the variable “i” (PC i) onto the sharename while using netuse and xcopy?

Thank you!

This discussion is locked

All Comments