Jump to content

How can i add the path of application to System path of OS?


Recommended Posts

hi~

i'm looking for a way to add the path of Java to System path of OS (XP and Windows 7).

I found the way to get the key value of Java(to the bin folder) at registry, and System path.

Java path value at registry is like this, and can be gotten easily.

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{5852F5E0-8BF4-11D4-A245-0080C6F74284}\1.0\HELPDIR]

@="C:\\Program Files\\Java\\jre7\\bin"

BTW, here is the problem to adding this value to System Environment.

It is easy to add this path to System Path at registry editor, but when i export System Environment key value as .reg file,

the value of path comes to be translated as hex value like below.

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

"Path"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\

00,46,00,69,00,6c,00,65,00,73,00,5c,00,4a,00,61,00,76,00,61,00,5c,00,6a,00,\

72,00,65,00,36,00,5c,00,62,00,69,00,6e,00,3b,00,25,00,53,00,79,00,73,00,74,\

00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,\

65,00,6d,00,33,00,32,00,3b,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\

00,6f,00,6f,00,74,00,25,00,3b,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,\

52,00,6f,00,6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,\

00,32,00,5c,00,57,00,62,00,65,00,6d,00,3b,00,43,00,3a,00,5c,00,50,00,72,00,\

6f,00,67,00,72,00,61,00,6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,5c,00,4d,\

00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,53,00,51,00,4c,00,\

20,00,53,00,65,00,72,00,76,00,65,00,72,00,5c,00,38,00,30,00,5c,00,54,00,6f,\

00,6f,00,6c,00,73,00,5c,00,42,00,69,00,6e,00,6e,00,5c,00,3b,00,43,00,3a,00,\

5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,00,46,00,69,00,6c,00,65,\

00,73,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,\

53,00,51,00,4c,00,20,00,53,00,65,00,72,00,76,00,65,00,72,00,5c,00,39,00,30,\

00,5c,00,54,00,6f,00,6f,00,6c,00,73,00,5c,00,62,00,69,00,6e,00,6e,00,5c,00,\

00,00

Any one who solve this problem or know how to add a path to System path?

Of course, i know how to add a path with Dos command "set path"

Link to post
Share on other sites

Test this:

$sKey = ("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment")
$sVal = "Path"
$sPath = RegRead($sKey, $sVal)
$sNewPath = "C:Program FilesJavajre7bin"
If StringRight($sPath, 1) <> ";" Then $sPath &= ";"
RegWrite($sKey, $sVal, "REG_EXPAND_SZ", $sPath & $sNewPath)

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...