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