I have a GUI application, and I hope it auto run after reboot/logout windows computer.
Here is how I use windows task scheduler:
first run a command to create a task: c:\Windows\System32\schtasks.exe /Create /TN taskname /XML taskname.xml /RU username /RP password /IT
after the task was created, in the general tab, "Run whether user is logged on or not" radio button was selected, and "Do not store password" checkbox wasn't checked. in triggers tab, I set to repeat the task in every 5 minutes.
After reboot the computer, it can auto trigger the app to run and show the GUI in 5 minute. However, if I logout and then login the computer, it will only trigger the app to run without showing the GUI, I have been waiting for about 10 minutes, I can only see the process of app is running in task manager. Unless I manually end the task and then run the task, it will run the app with a GUI.
Does anyone know why it happened and how to fix it?
Thanks,
This seems to be the way that recent versions of Windows' TaskScheduler.
According to Microsoft (emphasis added):
You can specify that a task should run even if the account under which the task is scheduled to run is not logged on when the task is triggered. To do this, select the radio button labeled Run whether user is logged on or not . If this radio button is selected, tasks will not run interactively. To make a task run interactively, select the Run only when user is logged on radio button.
Essentially, if you select 'Run whether user is logged on or not', the process will not start a UI.