Welcome to MSDN Blogs Sign in | Join | Help

Executing applications/scripts at User Log-on on Windows XP and Windows 2003 Server

I wanted to execute a script/application on my comp when a user logs on to adjust some of the settings specific to the user. I did not know how to go about it and had to scratch a little bit to find how I could achieve the desired result. I am posting it here, so that it is useful for others who might need to do something similar.

 

It is fairly simple:

Just go to the registry entry

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

 

Create a new key of Type String Value. The value of this key should point to the path of the application/script that you want to execute.

 

Bingo!!! You have just set-up an application, which would execute each time any user logs on to a machine.

 

Are you aware of any other ways in which a user can do this?

Published Thursday, March 02, 2006 6:59 PM by GauravS
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Executing applications/scripts at User Log-on on Windows XP and Windows 2003 Server

Thursday, March 02, 2006 9:04 AM by Kris
I think you can also put the exe in the Startup folder and it will be launched when the user logs in. I tried trhis for one of my RSS Readers and it works.

# re: Executing applications/scripts at User Log-on on Windows XP and Windows 2003 Server

Wednesday, March 15, 2006 10:17 AM by derek
You'd probably be better off in this case using RunOnce instead of Run - RunOnce, much as it sounds, only runs your program once then removes it from that line.

# re: Executing applications/scripts at User Log-on on Windows XP and Windows 2003 Server

Thursday, March 16, 2006 6:51 AM by GauravS
Hi Derek,

The RunOnce key is available under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

I just tested this with RunOnce. Being in the Local Machine, RunOnce would not suit my need as the entries under run once are only executed one time per machine - no matter which user logs on. There-after the key is removed as you said. I wanted a script which should always be executed when a user logs on to the system.

But this is a great find. I did not know about this :)

# re: Executing applications/scripts at User Log-on on Windows XP and Windows 2003 Server

Thursday, March 16, 2006 7:00 AM by GauravS
Hi Kris, can you share the location of the Startup folder you are referring to? I could find it under SysDrive:\Documents and Settings/<username> as well as SysDrive:\Windows\system32\...

# re: Executing applications/scripts at User Log-on on Windows XP and Windows 2003 Server

Thursday, March 16, 2006 2:42 PM by derek

Sorry, should have been more specific.  You can use
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce - it doesn't exist by default but if you create it, it acts like exactly what you need.


As for the Startup folder, if you're using a new XP installation it's n:\Documents and Settings\username\Start Menu\Programs\Startup and if you've got an upgraded-over-upgraded-over NT machine it's n:\Winnt\Profiles\Username\Start Menu\Programs\Startup.  Alternately, you could use the All Users Startup group (probably not what you're wanting to do) - but it's likely in n:\Documents and Settings\All Users\Start Menu\Programs\Startup.


# re: Executing applications/scripts at User Log-on on Windows XP and Windows 2003 Server

Thursday, March 23, 2006 4:01 AM by janet
can someone help finding a script.
i need to know what application are running on the computers at my work.

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker