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@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to