How to autorun a python script when a specific user logs on?

jack trades trades at none.com
Thu Feb 7 19:30:52 EST 2008


"Mike Hjorleifsson" <mhjorleifsson at gmail.com> wrote in message
news:c42fd745-82f0-4d73-ac56-fd1c8fb69556 at s13g2000prd.googlegroups.com...
> on windows you can put this in HKEY_Local_Machine\Software\Microsoft
> \Windows\Current Version\Run and it will run at logon (or fast user
> switch) for each user
> or if you only want to do it for a specific user you need to determine
> their CSLID and put it in the same locale under the HKEY_USERS\Users
> cslid... etc.

Thanks for sparing some time.  I was looking through the registry and found
that this works as long as you are logged in as the user you want to
autostart the program for:

def autostartProgram(name, location):
  os.system(r'reg add HKCU\software\microsoft\windows\currentversion\run /v
%s /t REG_SZ /d %s' % (name, location) )

Jack Trades





More information about the Python-list mailing list