2

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 127.0.0.1 //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)?

7
  • 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, 2012 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, 2012 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, 2012 at 18:23
  • 1
    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, 2012 at 20:13
  • 1
    I came across the same problem. Could you solve this somehow? Since I have found absolutely no solution approach, because MS thinks everything is running as it should. Or just the event / log If the major log meaningful would.
    – user162921
    Oct 3, 2012 at 18:57

0

Your Answer

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