Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send errors to a file within a batch file 1

Status
Not open for further replies.

Scottncs

IS-IT--Management
Jun 13, 2002
29
0
0
US
I am running this batch file and it works great to copy a file to all my networked pc using a text file with the system names within the for loop. If the machines are turned on it does the copy but if they are off it wont copy and I dont know which ones didnt get the file.

Here is my batch file

@echo on
for /F %%I in (c:\pcnames.txt) do copy c:\time.bat \\%%I\c$\Docume~1\AllUse~1\StartM~1\Programs\Startup


How can I log all the missed ones to a text file?
 
@echo off
for /F %%I in (xx) do if exist %%I (
copy c:\time.bat \\%%I\c$\Docume~1\AllUse~1\StartM~1\Programs\Startup > nul
) else (
echo %%I not found > log_file)


<< JOC >>
 
You really know your stuff. Thanks for the second time in a week.
 
Nah - a lot of it is taken from batch files written by a guy who used to work here long ago. Most of it is fairly simple stuff though - all I did this time was add an IF statement...
<< JOC >>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top