Advertisement
J2897

ImportSchedTask

Jan 23rd, 2016
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.55 KB | None | 0 0
  1. :: Released under the GNU General Public License version 3 by J2897.
  2.  
  3. @echo OFF
  4. setlocal
  5. pushd "%~dp0"
  6. title Scheduled Task Importer
  7.  
  8. REM Check for administrative privileges.
  9. ver | findstr "Version 6." >nul
  10. if %ERRORLEVEL% == 0 (
  11.     openfiles >nul
  12.     if errorlevel 1 (
  13.         exit /b 1
  14.     )
  15. )
  16.  
  17. REM Credentials for remote machine.
  18. set "USER=J2897"
  19. set "PASS=password"
  20.  
  21. REM Pass the password to schtasks.exe and tell it to import the XML file.
  22. echo %PASS%|schtasks /Create /TN "\Updates\Update Cygwin" /XML "SchedTask.xml" /RU %USER% /F
  23.  
  24. popd
  25. endlocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement