Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 14 down vote accepted

That's what the /RL option does. Example: SCHTASKS /Create /TN "New Task" /SC HOURLY /TR blah.exe /RU username /RP password /RL HIGHEST

share|improve this answer
can we use that for each version of Windows (from XP to 7 or 8, including Windows Server 2008) ? – Rolf Oct 9 '12 at 15:23
Not for Windows XP, according to Microsoft (…), also note the "this option is not available" comments for (XP and WinServer 2003) on… – Skatterbrainz May 4 '13 at 2:54
@Rolf check out my answer for a small script, that will work on both XP/2003 and Vista/2008 (or higher) – abstrask Jul 29 '14 at 12:19
I scrolled through the SCHTASKS help three times. I clearly missed it all three times. Thanks! – Brain2000 Jan 21 '15 at 22:36
/RL HIGHEST just saved my bacon. – kayleeFrye_onDeck Feb 20 at 1:37

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

share|improve this answer

Sorry for making this a separate answer, but multiple lines of code does not display well in comments.

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%
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .