0

I have a program (with GUI) to run 7/24 in windows. When the pc restarts(for example after the electricity went off for a while), I want the computer to continue running the app, so I created a task scheduler basic task to run the app on startup.

  1. When the task is set to be started on system start without caring for the user, the app GUI cannot be seen since the app starts in background. When I log in I cannot see it because it is started in the background and cannot take it to front.
  2. If I select to start the app iff the specific user (btw there is only 1 user in the system) logs in, the requirement "run the app 7/24" cannot be achieved, because a manual user log in is required to start the program. So, how can we set a GUI program on windows to always work?
3
  • 1
    You cannot depend on a single system running non stop. Won't work. Provide for weekly update and downtime.
    – anon
    Commented Aug 22, 2023 at 20:05
  • Maybe try calling a .bat/.ps1 in task scheduler that launches the app, or in task scheduler use something like cmd /c start "" C:\Folder\Program.exe
    – Paul π
    Commented Aug 22, 2023 at 20:15
  • Also -- If you're using Windows 10, some apps can automatically restart after a reboot (Settings > Sign-in options > Restart apps), although I wouldn't depend on this feature if it was a production/mission critical program. You could also try creating an entry in HKLM or HKCU\Software\Microsoft\Windows\CurrentVersion\Run`. That should prevent issue #1. I would look into a UPS if power outages are frequent and problematic.
    – Paul π
    Commented Aug 22, 2023 at 20:27

2 Answers 2

0

Autologon is a Microsoft tool to automate a user login at boot:

https://learn.microsoft.com/en-us/sysinternals/downloads/autologon

Obviously this is not very secure - read through the details on the linked page. However, it is one of the only ways to get software with a gui to automatically launch at startup in a valid, viewable session.

Most software generally has its back-end service processes detached from a front-end gui, like a webserver to a browser. I recommend searching for a similar solution where possible

0

An application can be made to run as a Windows Service.

To make a Windows application run as a service, use a third-party tools, such as SrvStart (which you might need to build) or NSSM to make each application a Service. Set its Start value to 2 (automatic), or otherwise as needed.

Caveats:

  • Using a Service requires that that it be started and stopped as a Service.
  • The applications used to create a Service are considered "hack tools", since they make changes on a deep system level, not apparent to the user.
  • Use care... it is possible to make a system unusable with mistakes in this process. Make a disk image so you can roll back if there is an issue!
1
  • Thank you. I'm using a windows server instance, it doesn't make sense that we have to use 3rd party tools to run a server-like process(service)
    – b.g.
    Commented Aug 24, 2023 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .