locked
Finding a file through a Batch File Please Help RRS feed

  • Question

  • I am trying to write a batch file that will scan all the PC's in my domain and find a certain file.  Then in the end it will put the results into a text file telling me which PC's dont have that certain file.  My batch is kind of weird it works when i log into my Admin account but when I try to run it as a local user it get no feed back.  Also when i try to run it as a local machine i get no feed back.  Can you please help me.

    FOR /F %%a IN ('NET VIEW') DO IF NOT EXIST "%%a\c$\Program Files\Common Files\Microsoft Shared\VC\msdia80.dll" @ECHO %%a >> Error.txt
    print Error.txt
    ren vctemp VCREDIST%date:~4,2%-%date:~7,2%-%date:~10%.txt
    move /y *.txt C:\Users\dcataldo\Desktop\New Folder
    del Error
    (This Code works when running off my Admin id and also %%a is list of all the PC's in a domain if that helps)


    For /F %%a in ('Net View') do (
    runas /env /user:\\%%a\administrator "FOR /F %%a IN ('NET VIEW') DO IF NOT EXIST:" "%%a\c$\Program Files\Common Files\Microsoft Shared\VC\msdia80.dll" echo %errorlevel% @echo %%a >> vctemp.txt
    )

    (this code doesnt work it deosnt give me any feedback and im trying to run it as local machine)


    Dominick
    • Moved by nobugz Friday, October 24, 2008 5:21 PM forums.technet.com (Moved from Common Language Runtime to Off-Topic Posts (Do Not Post Here))
    Friday, October 24, 2008 4:05 PM

Answers