Skip to content

Instantly share code, notes, and snippets.

@brianfgonzalez
Created September 21, 2016 19:21
Show Gist options
  • Save brianfgonzalez/48c8c3ac89e68b5b1f7dc1514f630102 to your computer and use it in GitHub Desktop.
Save brianfgonzalez/48c8c3ac89e68b5b1f7dc1514f630102 to your computer and use it in GitHub Desktop.
echo start /w "" notepad.exe > "%WinDir%\Temp\temp.bat"
echo del /f/q "%%WinDir%%\Temp\temp.bat" >> "%WinDir%\Temp\temp.bat"
schtasks /create /ru "NT AUTHORITY\SYSTEM" /tn "sysrun" /tr "cmd.exe /c ""%WinDir%\Temp\temp.bat""" /f /sc "ONIDLE" /i "999"
schtasks /run /tn "sysrun" /i
:loop
for /f "tokens=2 delims=: " %%f in ('schtasks /query /tn "sysrun" /fo list ^| find "Status:"' ) do (
if "%%f"=="Running" (
timeout /T 1 /NOBREAK > nul
goto loop
)
)
pause
schtasks /delete /tn "sysrun" /f
:test pwcreator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment