|I need to delete a single file from 16 computers. While I could create a batch file that has a DEL command for all 16, I would like to learn how to loop through such a task. The computers are named sequentially, i.e. PC1, PC2...PC16. |
I have limited experience with CMD syntax, but I would imagine I need something like this:
Foreach number IN (Numbers1-16.txt) DO (DEL \\PC%Number%\C$\FileToBeDeleted)
As far as I know, batch files don't support Do/While loops with a counter...or do they? I can envision a loop such as "DO (Del \\PC%i%\File) WHILE i<17, i++" but I don't know if/how that would work.
Is this possible, and if so, what would be the correct way of doing it?