Task scheduler can't show GUI of the application after logout and login (run whether user is logged on or not)

北慕城南 提交于 2019-12-11 05:34:53

问题


I have a GUI application, and I hope it auto run after reboot/logout windows computer.

Here is how I use windows task scheduler:

  1. first run a command to create a task: c:\Windows\System32\schtasks.exe /Create /TN taskname /XML taskname.xml /RU username /RP password /IT

  2. 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,


回答1:


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.



来源:https://stackoverflow.com/questions/39736810/task-scheduler-cant-show-gui-of-the-application-after-logout-and-login-run-whe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!