When I use the GUI Task Scheduler, I can easily check the "Run with highest privileges" checkbox.

I found no such option in the SchTasks command line too, however.

Is there a way to do that from the command line?


That's what the /RL option does.

Example: SCHTASKS /Create /TN "New Task" /SC HOURLY /TR blah.exe /RU username /RP password /RL HIGHEST


/RL level Sets the Run Level for the job. Valid values are LIMITED and HIGHEST. The default is LIMITED.


To add to @Skatterbrainz's answer: If you run the same command/script on XP/2003, specifying /RL, SchTasks.exe will fail to create the task.

You can make a script that will work on XP, 2003, Vista, 2008, 7, 2008R2 etc., by pulling the OS version from the registry. A batch script could look like this:

set runlevel=

REM Get OS version from registry
for /f "tokens=2*" %%i in ('reg.exe query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CurrentVersion"') do set os_ver=%%j

REM Set run level (for Vista or later - version 6)
if /i "%os_ver:~,1%" GEQ "6" set runlevel=/rl HIGHEST

REM Execute SchTasks.exe
schtasks.exe /create /tn "Task Name" /sc ONSTART /TR "C:\Scripts\somescript.cmd" /ru SYSTEM %runlevel%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.