Hi Expert,

I want to set my application (Exe file) to run when some one just start computer and doesn't need to login in to any account.

I find a way that set application to run as startup but it requires user to login in to account. But i want to run application without login into computer.

Any help is appreciated.....

6 Years
Discussion Span
Last Post by Reverend Jim

Why would you want an application to run before a user even logs in, and what is the purpose of it?


Perhaps the purpose is to do some housecleaning, start monitoring software, etc. There are many reasons why you would want to do this. That is why Microsoft provides an easy way to do this. Of course, the easy way is easy only if you have the correct version of Windows. If you can run GPEDIT.MSC then you have the correct version. If it runs, drill down as follows:

Computer Configuration
Windows Settings
Scripts (Startup/Shutdown)

Double click on "Startup" in the right hand panel then click on "Add". In the resulting dialog you can enter the name of a script (vbs) and optional parameters. A simple script to run a program is

set wso = CreateObject("Wscript.Shell")
wso.Run "notepad",0,false

That's it. The first parameter is the name of the task to run. Parameter two is the window status (0=no window, 1=show window) and parameter 3 is "wait for exit". False says start the task and continue with the script. True will pause the script until the task exits.


More detail on parameter 2

1 - Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.

2 - Activates the window and displays it as a minimized window.

3 - Activates the window and displays it as a maximized window.

4 - Displays a window in its most recent size and position. The active window remains active.

5 - Activates the window and displays it in its current size and position.

6 - Minimizes the specified window and activates the next top-level window in the Z order.

7 - Displays the window as a minimized window. The active window remains active.

8 - Displays the window in its current state. The active window remains active.

9 - Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.

10 - Sets the show-state based on the state of the program that started the application.

Examples from Script56.chm are:

'The following VBScript code opens a copy of the currently running script with 'Notepad.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad " & WScript.ScriptFullName

'The following VBScript code does the same thing, except it specifies the window 'type, waits for Notepad to be shut down by the user, and saves the error code 'returned from Notepad when it is shut down.

Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("notepad " & WScript.ScriptFullName, 1, true)

'The following VBScript code opens a command window, changes to the path to C:\ , 'and executes the DIR command.

Dim oShell
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run "cmd /K CD C:\ & Dir"
Set oShell = Nothing

GPEDIT also allows you to set scripts to run at shutdown, as well as (under User Configuration) Logon and Logoff


Thanks Reverend Jim for your nice help. I will try to implement it. But I have seen in your first response that it can be either run on Startup or Shutdown,
but I didn't want to run script on startup (when user login). I need a way in which application start before any user login.

The below line in your response indicate that it will run on Startup or Shutdown.
Scripts (Startup/Shutdown).


What I said was that you can set up scripts to run at any of the following events:

1) Windows startup
2) Windows shutdown
3) User logon
4) User logoff

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.