473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

change windows system path from cygwin python?

gry
[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.

Jul 18 '05 #1
6 4156
gr*@ll.mit.edu 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
Jul 18 '05 #2
>
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.
Jul 18 '05 #3
<gr*@ll.mit.edu> 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>

Jul 18 '05 #4
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
Jul 18 '05 #5
Fredrik Lundh wrote:
<gr*@ll.mit.edu> 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
Jul 18 '05 #6
gry
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!

Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Noah | last post by:
Does anyone have a function to convert back and forth between NT style paths and POSIX style? It seems trivial, but I want to make sure I don't overlook some obscure detail. Is it a simple matter...
3
by: David Isal | last post by:
hi all, i'm new to python and i'm trying to build a python extension on win98, written in c++, with cygwin. but i keep having the same error message, and i didnt't find much resources on the web...
4
by: Bob Roberts | last post by:
How can I make it so that I can pass anything into os.system() any command that I would type into the command line (bash on cygwin)? For example, "lower" is a small script of mine that I use...
4
by: Claudio Grondi | last post by:
I need to unpack on a Windows 2000 machine some Wikipedia media .tar archives which are compressed with TAR 1.14 (support for long file names and maybe some other features) . It seems, that...
3
by: Abby | last post by:
I'm now using Cygwin as my compiler for C code. I use Dev-c++ as my editor. The reason why I chose Cygwin compiler instead of the compiler that came with Dev-C++ is that I believe it uses the same...
27
by: Julien Fiore | last post by:
Do you wand to install Pyrex on Windows ? Here is a step-by-step guide explaining: A) how to install Pyrex on Windows XP. B) how to compile a Pyrex module. Julien Fiore, U. of Geneva
6
by: kai rosenthal | last post by:
Hello, with ls -l on windows I get -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile How can I get on windows with a standard python 2.2 (without windows extensions) the information "500" and...
7
by: Franz Steinhaeusler | last post by:
Hello, I'm only curious. Why is Python and most extension (also wxPython) not built using an open source compiler like gcc or g++ on Windows? I'm always wondering, why Microsoft is still...
0
by: Berlin Brown | last post by:
I am trying to run some basic unit tests, but I can't get the paths setup in python/cygwin to pick up my modules. This code works fine in linux and I installed python through cygwin not as part...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.