PC Review


Reply
Thread Tools Rate Thread

add to a value, not replace

 
 
=?Utf-8?B?SmFuTGlzYmplcmc=?=
Guest
Posts: n/a
 
      10th Nov 2006
Hi

I need to add an extra path to the path on all my domain computers.

The computers allready have a path:
"%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem"
(Found in registry:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment] )

I need to add an extra path (c:\pctools) to that.

I tried with a .reg file, but I can't get it to add to what is allready in
the key - it replaces the old value with the new, but I need it to add the
new to the old

..reg file that sets the path to c:\pctools:
"REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment]
"Path"= hex(2):63,3a,5c,70,63,74,6f,6f,6c,73"

How can I get it to add my path instead of replacing it, via the .reg file ?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmFuTGlzYmplcmc=?=
Guest
Posts: n/a
 
      10th Nov 2006
Couldn't wait, so I found the answer myself.

Script:

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * From Win32_Environment Where Name = 'Path'")

For Each objItem in colItems
strPath = objItem.VariableValue & ";C:\Scripts\"
objItem.VariableValue = strPath
objItem.Put_
Next

located here:
http://www.microsoft.com/technet/scr...6/hey0828.mspx

 
Reply With Quote
 
=?Utf-8?B?SmFuTGlzYmplcmc=?=
Guest
Posts: n/a
 
      10th Nov 2006

Couldn't wait, so I found the answer myself.

Script:

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * From Win32_Environment Where Name = 'Path'")

For Each objItem in colItems
strPath = objItem.VariableValue & ";C:\Scripts\"
objItem.VariableValue = strPath
objItem.Put_
Next

located here:
http://www.microsoft.com/technet/scr...6/hey0828.mspx

 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      10th Nov 2006
In microsoft.public.win2000.registry =?Utf-8?B?SmFuTGlzYmplcmc=?=
wrote:

> Hi
>
> I need to add an extra path to the path on all my domain
> computers.
>
> The computers allready have a path:
> "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem"
> (Found in registry:
> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
> Manager\Environment] )
>
> I need to add an extra path (c:\pctools) to that.
>
> I tried with a .reg file, but I can't get it to add to what is
> allready in the key - it replaces the old value with the new,
> but I need it to add the new to the old

[ ]

I suggest pathman.exe from the Resource Kits
or look at this,

Editpath.exe
epath2.zip
http://internet.cybermesa.com/~bstewart/misctools.html
 
Reply With Quote
 
Dave Patrick
Guest
Posts: n/a
 
      11th Nov 2006
And also setx.exe from the resource kit.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Mark V" wrote:
| I suggest pathman.exe from the Resource Kits
| or look at this,
|
| Editpath.exe
| epath2.zip
| http://internet.cybermesa.com/~bstewart/misctools.html


 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      14th Nov 2006
In microsoft.public.win2000.registry Dave Patrick wrote:

> And also setx.exe from the resource kit.


Thanks Dave. "I forgot."
 
Reply With Quote
 
Dave Patrick
Guest
Posts: n/a
 
      14th Nov 2006
np

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Mark V" wrote:
| Thanks Dave. "I forgot."


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
How do I replace color of selected text using the replace feature bb Microsoft Word Document Management 5 17th Jun 2008 05:19 AM
String.Replace method not usable when knowing index to replace Lonifasiko Microsoft C# .NET 10 17th Oct 2007 09:02 PM
find and replace - replace data in rows to separated by commas =?Utf-8?B?bXNka2Vy?= Microsoft Excel Worksheet Functions 1 15th Apr 2006 01:00 AM
'Replace fonts...' should let me replace font style, size, effect. =?Utf-8?B?Qm9uZ29CdXNobWFu?= Microsoft Powerpoint 0 10th Feb 2005 04:35 PM
Replace methode, Replace Function, Stringbuilder replace, Regex Replace, Split Cor Microsoft VB .NET 4 1st Mar 2004 02:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:42 AM.