473,387 Members | 1,569 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,387 software developers and data experts.

Change environment setting path

Hi,
I want to read the envorinment setting "path" and then on certain
conditions change this setting.
ex path : "%SystemRoot%\system32;%SystemRoot%;%SystemRoo t%
\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. "%SystemRoot%\"
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 "%SystemRoot%" variables in my path.

The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Registry.GetValue _
("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Cont rol\Session
Manager\Environment", "Path", Nothing)

Some advice ?

Jun 27 '08 #1
2 2131
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%\system32;%SystemRoot%;%SystemRoo t%
\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. "%SystemRoot%\"
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 "%SystemRoot%" variables in my path.

The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Registry.GetValue _
* * * * ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Cont rol\Session
Manager\Environment", "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.comwrote:
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%\system32;%SystemRoot%;%SystemRoo t%
\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. "%SystemRoot%\"
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 "%SystemRoot%" variables in my path.
The registry key is a REG_EXPAND_SZ key
readValue = My.Computer.Registry.GetValue _
* * * * ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Cont rol\Session
Manager\Environment", "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
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...
3
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...
1
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"),...
3
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...
19
by: Ju Hui | last post by:
is python search module by paths in sys.path? how to change it manuallly?
11
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...
4
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...
2
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...
3
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: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.