473,847 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change environment setting path

Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\s ystem32;%System Root%;%SystemRo ot%
\System32\Wbem; C:\Program Files\Symantec\ pcAnywhere\;"

I want to add some folders to the path and delete some.
But when i read the path all the system variables "ex. "%SystemRoo t%\"
are converted to the exact folder
I store this in a string and change the string an then write to string
to the registry.
But i lose the "%SystemRoo t%" variables in my path.

The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Reg istry.GetValue _
("HKEY_LOCAL_MA CHINE\SYSTEM\Cu rrentControlSet \Control\Sessio n
Manager\Environ ment", "Path", Nothing)

Some advice ?

Jun 27 '08 #1
2 2151
On Apr 17, 10:33*pm, bart.hernalst.. .@gmail.com wrote:
Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\s ystem32;%System Root%;%SystemRo ot%
\System32\Wbem; C:\Program Files\Symantec\ pcAnywhere\;"

I want to add some folders to the path and delete some.
But when i read the path all the system variables "ex. "%SystemRoo t%\"
are converted to the exact folder
I store this in a string and change the string an then write to string
to the registry.
But i lose the "%SystemRoo t%" variables in my path.

The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Reg istry.GetValue _
* * * * ("HKEY_LOCAL_MA CHINE\SYSTEM\Cu rrentControlSet \Control\Sessio n
Manager\Environ ment", "Path", Nothing)

Some advice ?
Hi,
This may help in maintaining your code:
http://www.freevbcode.com/ShowCode.asp?ID=8293

HTH,

Onur
Jun 27 '08 #2
On 17 apr, 22:15, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
On Apr 17, 10:33*pm, bart.hernalst.. .@gmail.com wrote:


Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\s ystem32;%System Root%;%SystemRo ot%
\System32\Wbem; C:\Program Files\Symantec\ pcAnywhere\;"
I want to add some folders to the path and delete some.
But when i read the path all the system variables "ex. "%SystemRoo t%\"
are converted to the exact folder
I store this in a string and change the string an then write to string
to the registry.
But i lose the "%SystemRoo t%" variables in my path.
The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Reg istry.GetValue _
* * * * ("HKEY_LOCAL_MA CHINE\SYSTEM\Cu rrentControlSet \Control\Sessio n
Manager\Environ ment", "Path", Nothing)
Some advice ?

Hi,
This may help in maintaining your code:http://www.freevbcode.com/ShowCode.asp?ID=8293

HTH,

Onur- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -
Hi,
My code is working.
I don't think i would have found this without your help
Thank you very much
Bart
Jun 27 '08 #3

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

Similar topics

3
7286
by: Peter Vestergaard | last post by:
Hi Probably a simple question but I have not been able to find out how: I want my python script to generate a path based on some simple lookups and then change my path so that when the script exits my command prompt (from which I launched the script) is standing at this path. The path already exists. I have tried chdir(path), system('cd '+path) and many others but none changes my actual path. Hope anyone can help Regards, Peter...
3
12223
by: Xiaopeng Qu | last post by:
Hi, I installed DB2 8.1 Express with multiple language: English and Chinese, but the interface like: Control Center, CLP, etc alway display Chinese, is there a way to change the display language to English? Thanks! Sean
1
1120
by: beaker | last post by:
Hi, I want to be able to add to the PATH environment variable in one of my programs. Is there a way to do this? I know how to check the path using Environment.GetEnvironmentVariable("path"), just can't work out how to add to it! Thanks, Gary
3
2830
by: vatsa | last post by:
Hi all, we can simply change value of PS1 from command prompt . but I want to change the value of PS1 from within a c program. i tried to do that using getenv & putenv. but it is n't working... . i even wrote 1 code to print all environment variables, among them PS1 wasn't there. but when i use "set" command on command prompt, it displays PS1 too among other environment variables...
19
40738
by: Ju Hui | last post by:
is python search module by paths in sys.path? how to change it manuallly?
11
26661
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
4
4331
by: Steve | last post by:
i'm trying to re-use scripts, typically called via a browser, in the php cli. the cli calls are made through cron jobs. i'm hitting some unknowns as to path info. here's the error i'm getting thus far: "PHP Warning: require_once(../../../../../../site.cfg.php): failed to open stream: No such file or directory in /var/www/html/dev/admin/cli/import.repair.orders.cli.php on line 5" i'm executing the cli from:
2
2173
by: Henry Hollenberg | last post by:
Hello, I have written a script that uses environment variables set during a particular users login in ".bash_profile" and ".profile". I have changed to that users uid and gid in my python script using: import os os.setegid os.setgid
3
2012
by: smitty1e | last post by:
Just a fun exercise to unify some of the major input methods for a script into a single dictionary. Here is the output, given a gr.conf file in the same directory with the contents stated below: smitty@localhost ~/proj/mddl4/test $ ./inputs.py {'source_db': '/home/sweet/home.db'} smitty@localhost ~/proj/mddl4/test $ source_db="test_env" ./inputs.py {'source_db': 'test_env'} smitty@localhost ~/proj/mddl4/test $ ./inputs.py -f "test_cli"
0
10995
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10654
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10347
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7888
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7061
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4130
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3168
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.