6

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. enter image description here

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 question should probably be on SuperUser, rather than StackOverflow. Indeed, arguably it's a duplicate of this question on SuperUser: superuser.com/questions/78359/…
    – amaidment
    Dec 7, 2016 at 10:47

1 Answer 1

9

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.

3
  • yes, I have figured out that. Thanks for your info.
    – Ng2-Fun
    Dec 7, 2016 at 13:55
  • FYI - I found a workaround, which I have described in my answer to my own similar (but slightly different) SO question.
    – amaidment
    Jan 3, 2017 at 17:16
  • Unbelievable that it's not possible to start an app with interface automatically after the reboot of a Server 2019! I have wasted a few hours to see (can't believe) Thanks MS! Oct 5, 2020 at 10:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.