Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > change windows system path from cygwin python?

Reply
Thread Tools

change windows system path from cygwin python?

 
 
gry@ll.mit.edu
Guest
Posts: n/a
 
      12-15-2004
[Windows XP Pro, cygwin python 2.4, *nix hacker, windows newbie]

I want to write some kind of install script for my python app that
will add c:\cygwin\usr\bin to the system path. I don't want
to walk around to 50 PC's and twiddle through the GUI to:

My Computer --> Control Panel --> System --> Advanced --> Environment


How can a python, or even a .bat script modify the system PATH?
It doesn't appear to be in the registry.

 
Reply With Quote
 
 
 
 
Harlin Seritt
Guest
Posts: n/a
 
      12-15-2004
wrote:

> [Windows XP Pro, cygwin python 2.4, *nix hacker, windows newbie]
>
> I want to write some kind of install script for my python app that
> will add c:\cygwin\usr\bin to the system path. I don't want
> to walk around to 50 PC's and twiddle through the GUI to:
>
> My Computer --> Control Panel --> System --> Advanced --> Environment
>
>
> How can a python, or even a .bat script modify the system PATH?
> It doesn't appear to be in the registry.


If you're just wanting to add a path to the system environments you can do:

"set path=c:\path\to\whatever" # As a line in a Batch file


--
Harlin Seritt
 
Reply With Quote
 
 
 
 
Jeff Lindholm
Guest
Posts: n/a
 
      12-15-2004
>
> I want to write some kind of install script for my python app that
> will add c:\cygwin\usr\bin to the system path. I don't want
> to walk around to 50 PC's and twiddle through the GUI to:
>
> My Computer --> Control Panel --> System --> Advanced --> Environment
>
>
> How can a python, or even a .bat script modify the system PATH?
> It doesn't appear to be in the registry.
>

It is in the registry
All users = local machine - "System\CurrentControlSet\Control\Session
Manager\Environment"
Current User = Current User - Environment

The only issue with this is you will have to reboot for it take effect.


 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      12-15-2004
<> wrote:

> I want to write some kind of install script for my python app that
> will add c:\cygwin\usr\bin to the system path. I don't want
> to walk around to 50 PC's and twiddle through the GUI to:
>
> My Computer --> Control Panel --> System --> Advanced --> Environment
>
>
> How can a python, or even a .bat script modify the system PATH?
> It doesn't appear to be in the registry.


did you look under

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Se ssion Manager\Environment

?

</F>



 
Reply With Quote
 
Jason Tishler
Guest
Posts: n/a
 
      12-15-2004
On Wed, Dec 15, 2004 at 06:43:35PM +0000, Jeff Lindholm wrote:
> The only issue with this is you will have to reboot for it take
> effect.


The above is not quite true -- at least under NT/2000/XP. The reboot is
only necessary for the SCM (and services) to notice the change.
Otherwise, you just need to send a special Windows event:

http://support.microsoft.com/?kbid=104011

There are tools that will set environment variables and send the
required event. For example, see the following:

http://www.microsoft.com/windows2000...ing/setx-o.asp

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      12-15-2004
Fredrik Lundh wrote:
> <> wrote:
>>How can a python, or even a .bat script modify the system PATH?
>>It doesn't appear to be in the registry.

>
> did you look under
> HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Se ssion Manager\Environment


And see also this helpful recipe:

http://aspn.activestate.com/ASPN/Coo...n/Recipe/55993
 
Reply With Quote
 
gry@ll.mit.edu
Guest
Posts: n/a
 
      12-16-2004
The _winreg api looks helpful; unfortunately, I'm trying to stick to
what can be got
from the cygwin install -- no _winreg. Simplicity of installation is
quite important.
(I'm using cygwin to get the xfree86 X-server, which is the whole point
of this exercise)

I have found the cygwin command-line "regtool" for munging the
registry, so I plan
to use that via os.popen.
Thanks all for pointing me to the right place in the registry!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PExpect on Windows System Using Cygwin Dave Angel Python 2 09-25-2009 10:09 AM
confirm unsubscribe from cygwin@cygwin.com cygwin-help@cygwin.com Python 0 09-05-2003 04:42 PM
WELCOME to cygwin@cygwin.com cygwin-help@cygwin.com Python 1 09-05-2003 07:46 AM
confirm unsubscribe from cygwin-announce@cygwin.com cygwin-announce-help@cygwin.com Python 0 09-05-2003 01:29 AM
confirm unsubscribe from cygwin@cygwin.com cygwin-help@cygwin.com Python 0 09-04-2003 06:34 PM



Advertisments