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

This works:

schtasks /create /tn calc /tr c:\Windows\system32\calc.exe /sc minute

After running this and a computer restart:

schtasks /create /tn calc /tr c:\Windows\system32\calc.exe /sc onstart

the calc.exe process is present in Task Manager, but the calc window is missing.

When I run the onstart task manually, the calc window shows up:

schtasks /run /tn calc

What I've tested so far:

  • calc.exe, osk.exe, cmd.exe
  • ping -n 30 //a 'sort of' sleep function
  • a .bat file which created a new file and writes a line of text inside the file - worked as expected, but there was no GUI window visible
  • c:\Windows\SchedLgU.txt log file - no errors

All tasks were run by the user that was in the Administrators group.

Why Task scheduler fails to open a GUI application window when /sc onstart parameter specified (or what am I doing wrong)?

share|improve this question
did you try a delay in the scheduler? or a full 30 second delay in a batch. I am wondering if it is possible that all the desktop noise is going on, and other startup things, and it is just the usual thrashing mess. EX: with XP in the other computer the User tries to run the corner tv program before the mess of other things is done and settled, it can lockup. The user waits till everything is settled first. – Psycogeek Mar 6 '12 at 16:18
how many times have you seen :-) a visual indication of the stuff that runs out of the task scheduler. Imo that is what makes the thing evil. In the win 7 one there are even switches for insuring hidden. So be sure to get in there and see what your command line entries are ending up via the GUI and all the switches in there. – Psycogeek Mar 6 '12 at 16:35
@Psychogeek: thanks for the response. Actually, I was able to see the cmd window and the calc window if I logged in really fast, but this occured only once contrary to multiple tests I've made. I'm not sure, but the window showed up probably because I logged in so fast that the Scheduler service was running after I logged in on my user account this one single time (as Task Scheduler is a service and services are launched before the login screen). I'd be really glad for some confirmation / description why it works the way it works (as the calc.exe proc was launched by the user I log in as). – colemik Mar 6 '12 at 18:23
Ahhh. I autolog locally. what would be the ramifications for you to have it occur after log-in? – Psycogeek Mar 6 '12 at 18:28
then I have to explain that I've asked the question purely because I'm testing the schtasks command and I just want to understand how it works the way it works. – colemik Mar 6 '12 at 20:13

You must log in to answer this question.

Browse other questions tagged .