19

I have a windows application with user Interface that do some stuff... Now my client wants that, when he pushes the power button MyApplication run before he forced to input the username and password! comment: the system is multi user on windows XP or Seven.

Is it possible anyway?

Cœur
  • 37,241
  • 25
  • 195
  • 267
vesna
  • 403
  • 1
  • 3
  • 13
  • 1
    [This](http://stackoverflow.com/questions/3070152/running-a-process-at-the-windows-7-welcome-screen) and [this](http://stackoverflow.com/questions/9868079/running-a-process-with-gui-on-windows-xp-logon-screen-net-pinvoke) might help. – Scis Sep 19 '12 at 09:01
  • 1
    Will Lasalle's answer works perfect and does **not** require `Group policies` or `windows services`. – Jonathan Jul 18 '21 at 13:57
  • write your program as a windows service. – AliNajafZadeh Jun 09 '22 at 05:00

6 Answers6

18

I found the way to do this was to create a scheduled task with a trigger for "on startup". This starts the application before windows logon. This is particularly useful in a server type environment if you need to have something run that is not a service.

gparyani
  • 1,958
  • 3
  • 26
  • 39
Will Lasalle
  • 181
  • 1
  • 2
17

It is simple. The process is.

  1. Run gpedit.msc
  2. Go to computer Configuration -> Windows Setting -> Scripts(Startup/shutdown)
  3. Go to Startup properties then you will get the new windows.
  4. Now add the program that you want to run before login.
vusan
  • 5,221
  • 4
  • 46
  • 81
  • 1
    That setting belongs to the user. – Billy ONeal Sep 20 '12 at 04:23
  • 1
    thank you but it didnt work for me.Are you sure that application.exe could run before startup? – vesna Oct 01 '12 at 06:15
  • 3
    You are a genius. No one else on the internet seems to know about this. It works great, especially for apps that need to run with UI. After hours of failed testing with services, scheduled tasks, etc., it works. Thank you! – Sam Dec 31 '21 at 06:22
  • 1
    @BillyONeal It shouldn't, if you're under computer configuration. – Josh C Feb 06 '22 at 03:05
  • 1
    Would this also work for opening documents with the standard application that is assigned to the document's filename extension? Specifically, I'd like to run an AutoHotkey script before Windows login, the script being an *.ahk document that is assigned to AutoHotkey.exe. Can I simply use the script's name and path for the startup script? – David.P Feb 07 '22 at 09:56
  • Word of warning: Startup scripts and scheduled tasks will NOT work with GUI-based apps. Your best bet is to auto-login (https://learn.microsoft.com/en-us/sysinternals/downloads/autologon) and have such applications launch based on login (`C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup`). – Mike Weir Aug 21 '23 at 19:23
4

The right way to do this is to implement a Windows service.

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
2

I've used this article here as I run a Minecraft server which I need to have the console interactive so I can manage the server and running it as a service is not a good solution in such a case: https://www.tenforums.com/tutorials/138685-turn-off-automatically-restart-apps-after-sign-windows-10-a.html

What I did was edit the registry:

  1. Go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  2. Create a new DWORD value (if this DWORD doesn't exist already) and call it RestartApps with the value of 1

This now starts apps that usually startup before you log in and starts the programs in shell:startup

0

Startup scripts and scheduled tasks will NOT work with GUI-based apps. Your best bet is to setup auto-login (https://learn.microsoft.com/en-us/sysinternals/downloads/autologon) and have such applications launch based on login (C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup or any other method).

Mike Weir
  • 3,094
  • 1
  • 30
  • 46
-13

You can not run an exe without first loading the operating system. You can, however, run the exe without logging in first. Just add copy and paste the shortcut for the exe into C:\Documents and Settings\Administrator[or other user name]\Start Menu\Programs\Startup. Then check msconfig to make sure your exe is checked to run on startup.

Boo
  • 9