Jump to content

Set System Path


Recommended Posts

What is the easiest way to set the system path here:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]

Value name: PATH

Type:REG_EXPAND_SZ

New Value Data:c:\program files\mytoolbox

I want to append a new value, I found pathman.exe but was wondering if the forum had a clean way to do this without including external utilites.

Link to comment
Share on other sites

why would you want that... there is a reason that it is the way it is

Link to comment
Share on other sites

I found some of this code in another topic but it doesn't work on the 3rd to last line

; Append to PATH

Func _ToolKit()

$sSep = ";"

$sType = "REG_SZ"

$path = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PATH")

If @extended = 7 Then

$sSep = @LF

$sType = "REG_MULTI_SZ"

EndIf

$path1 = $sSep & "c:\program files\mytools"

$path2 = $path & $path1

RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", $path2)

If @error <> 0 Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PATH", $sType, $path2)

EndFunc ;==>_ToolKit

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...