[python-win32] Adding an exe to startup...

Kevin Horn kevin.horn at gmail.com
Tue Sep 16 20:40:58 CEST 2008


There are a number of ways to do this:

1) add a shortcut to the "Startup start menu folder
2) add registry entries to various places like *
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
*    see here for some other locations:
http://www.doshelp.com/HowToView/Registry_Keys.htm
3) make it a service and set it to "Automatic" (probably more work than you
want to do)
4) There are other more esoteric ways, but I think the above probably covers
anything you are likely to want to do.

Kevin Horn

On Tue, Sep 16, 2008 at 9:51 AM, Tim Golden <mail at timgolden.me.uk> wrote:

> John Bunting wrote:
>
>> I've been having some trouble finding information on how to add an exe
>> that I have created to the startup of my windows box.  I would like to know
>> how I should go about adding the exe to the startup menu, without using the
>> gui interface.  I want to be able to automate this because I'm also going to
>> be giving out some of this code to different users and I don't want to have
>> to have them manually add the exe.
>>
>
>
> The startup menu is basically a folder which you can put
> shortcuts into in the normal way. For simplicity's sake,
> I recommend using (my) winshell module:
>
> http://timgolden.me.uk/python/winshell.html
>
> but it's only a very simple wrapper around the pywin32
> extensions so you might prefer to roll your own. At
> least you can look at the source. The following code
> will do what you want (assuming you want Python to
> start up automatically!)
>
> <code>
> import os, sys
> import winshell
>
> startup = winshell.startup () # use common=1 for all users
> print startup
>
> winshell.CreateShortcut (
>  Path=os.path.join (winshell.startup (), "Python.lnk"),
>  Target=sys.executable,
>  Icon=(sys.executable, 0),
>  Description="Python"
> )
>
> </code>
>
> TJG
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080916/360137d7/attachment.htm>


More information about the python-win32 mailing list