Question

I have created a simple script to perform task for eg.delete files and to output a log file stating if the job was successful or not. But it only seems to output the last computer's ip address in the log and not each and every comps ip. Is there anything i can add to make it show all the tasks into the log line by line showing the ip. Even if the task is not done it still reflects the same in the log.

My sample code goes something like

@echo off
for /F %%a in (vlans2.txt) do (
    ECHO connection to subnet %%a, please wait....
    PING -n 1 %%a|find "Reply from " >NUL

     psexec \\%%a cmd /c rmdir /S /Q d:\ 
pause    IF %ERRORLEVEL% neq 0 (ECHO Subnet %%a is unreachable) > c:pstools\log.txt

    else ECHO Subnet %%a has passed > c:pstools\log.txt




)
ECHO All Actions Done....................
Was it helpful?

Solution

> creates a file anew.

>> creates a file or appends to an existing file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top