Freigeben über


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?

Comments

  • Anonymous
    March 02, 2006
    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.
  • Anonymous
    March 15, 2006
    The comment has been removed
  • Anonymous
    March 15, 2006
    Hi Derek,

    The RunOnce key is available under HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRunOnce

    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 :)
  • Anonymous
    March 15, 2006
    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:Windowssystem32...
  • Anonymous
    March 16, 2006

    Sorry, should have been more specific.  You can use
    HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRunOnce - 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 SettingsusernameStart MenuProgramsStartup and if you've got an upgraded-over-upgraded-over NT machine it's n:WinntProfilesUsernameStart MenuProgramsStartup.  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 SettingsAll UsersStart MenuProgramsStartup.


  • Anonymous
    March 22, 2006
    can someone help finding a script.
    i need to know what application are running on the computers at my work.