| 1. |
Solve : Bat to test existence of a file on list of computers and copy new file.? |
|
Answer» Hi All Interrogate several computers, listed in a .txt file (currently only contains 3 hosts for test purposes) We don't do that here.Quote We don't do that here. Not sure what is meant by this comment. I am administering a NETWORK of some 400+ computers, some with CAD installed. Several have been infected with a mild worm that has corrupted a .lsp file. I wanted to interrogate each computer, check for the existence of the program and replace the corrupt file. I thought that this was a forum where I would be able to find some sensible help regarding a few problems I have in in writing a batch file to that effect. Apologies for my ignorance. You generate a computer name in the %%a variable but then fail to use it in existence test. Try it this way: Code: [Select]IF EXIST "\\%%a\c$\Program Files\AutoCAD Architecture 2010\Support\acad2010doc.lsp" GOTO COPY_FILE On another level, the logic seems illogical. If the lsp file exists, the logic goes to copy_file, drops into the pause, then exits the code. Try either moving the copy_file logic into the for statement and using a if/else construct, or, use a call instead of a goto, and use goto :eof statements after the for loop and after the the copy statement. Why the pause statement? The output is redirected to a log file, so you shouldn't need it. Batch file are best run from the COMMAND prompt. |
|