3
5
2008
2

Java環境變數自動設定

Set WSHShell=CreateObject("Wscript.shell")
Dim JavaVer,HomePath,EnvPath,Temp
EnvPath ="HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"
JavaVer = WshShell.RegRead("HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion")
HomePath = WshShell.RegRead("HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\"+JavaVer+"\JavaHome")
Temp = WshShell.RegRead(EnvPath+"Path")

WshShell.RegWrite EnvPath+"Path", Temp+";"+HomePath+"\bin","REG_EXPAND_SZ"
WshShell.RegWrite EnvPath+"ClassPath",".;"+HomePath+"\lib",     "REG_SZ"           
WshShell.RegWrite EnvPath+"JAVA_HOME", HomePath, "REG_SZ"
WshShell.RegWrite EnvPath+"JRE_HOME", HomePath, "REG_SZ"
MsgBox "Java環境變數設定完成!", vbInformation, "寫入完成"

 
Category: Others | Tags: java vbscript

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com