daily pastebin goal

Remote Commander (transitive)

sweenig Feb 27th, 2014 996 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. net use Y: \\sourceserver\d$
  3. for /F %%A in (%1) do (
  4.  echo %%A
  5.  net use z: \\%%A\d$
  6.  copy /y Y:\myscript.bat Z:\myscript.bat
  7.  schtasks /create /s %%A /tn "RunMe" /tr D:\myscript.bat /sc ONCE /ru ""
  8.  schtasks /run /s %%A /tn "RunMe"
  9.  :waitforit
  10.  schtasks /query /s %%A
  11.  choice  /t:N,5 Has it finished running
  12.  IF ERRORLEVEL 2 GOTO waitforit
  13.  schtasks /delete /s %%A /tn "RunMe"
  14.  del /q z:\myscript.bat
  15.  net use z: /delete
  16. )
  17. net use y: /delete
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand