Jump to content
Sign in to follow this  
kodius

Set System Path

Recommended Posts

kodius

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.

Share this post


Link to post
Share on other sites
KaFu
Richard Robertson

AutoIt has registry functions. What's wrong with using them?

Share this post


Link to post
Share on other sites
Valuater

Not sure exactly... but, maybe FileChangeDir(@ScriptDir)

Changes the current working directory.

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Richard Robertson

No, Val, the OP is trying to change the Path environment variable.

Share this post


Link to post
Share on other sites
CodyBarrett

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

Share this post


Link to post
Share on other sites
Richard Robertson

Are you kidding? There are a lot of reasons to change the path variable.

Share this post


Link to post
Share on other sites
kodius

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.