473,624 Members | 2,615 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 2142
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
7274
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
12213
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
1113
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
2820
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
40696
by: Ju Hui | last post by:
is python search module by paths in sys.path? how to change it manuallly?
11
26571
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
4324
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
2151
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
2001
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
8246
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8179
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8631
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...
1
8341
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8490
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...
0
5570
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
4184
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2612
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
1489
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.