Got a spare silver platter so here we go....
Well actually its not my silver platter. The code is taken from the example. I just replaced the values to replace with the ones suitable for you.
Code:
$CValue = "k:\ora81"
$RValue = "k:\ora92"
$RC = PathMod($CValue, $RValue)
;
;
; Modifies the System Enviornment Variable
; This replaces a specific value with another Value.
;
;Name : PathMod
;Author: WonderBoy
;Action: Modifies the System Enviornment Variable
;Date: 11/19/03
;syntax: PathMod($CValue,$RValue)
;Parameters: $CValue = path that you want to remove
; $RValue = path that you want to substitue
;
;EXAMPLE(s): $CValue = "c:\program files\Adobe"
; $RValue = "c:\Adobe"
; $RC = PathMod($CValue, $RValue)
; Returns:
; 0 Value was found and path changed
; 1 failed to write registry value
; 2 $CValue was not passed or empty
; 3 $RValue was not passed or empty
;
Function PathMod($CValue, $RValue)
Dim $Array, $aCntr, $KeyVal2, $fCntr, $stat, $KeyLoc, $Keynam
$aCntr = 0
$fCntr = 0
$stat = "FALSE"
$KeyLoc = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
$keyNam = "Path"
If $CValue = "" OR $RValue = ""
Select
Case $CValue = ""
$Pathmod = 2
Case $RValue = ""
$Pathmod = 3
EndSelect
Return
EndIf
$KeyVal = ReadValue ($KeyLoc, $KeyNam)
$Array = Split($KeyVal,";",-1)
For Each $Element In $Array
If $Element = $CValue
$Array[$acntr] = $RValue
$stat = "TRUE"
EndIf
$acntr = $acntr + 1
Next
For Each $Element In $Array
If $fCntr = 0
$KeyVal2 = $element
$fcntr = 1
Else
$keyVal2 = $KeyVal2 +";"+ $Element
$fcntr = $fcntr + 1
EndIf
Next
If $Stat = "TRUE"
$RC = WriteValue($Keyloc,$KeyNam,$KeyVal2,"REG_SZ")
If $RC = 0
$PathMod = 0
Return
Else
$Pathmod = 1
Return
EndIf
EndIf
EndFunction