设置路径的vbs脚本

下面这段vbs代码会将当前的目录加入到路径,同时添加一个新的环境变量,值为当前路径

Set WshShell = WScript.CreateObject(“WScript.Shell”) 
 
Set Env = WshShell.Environment(“SYSTEM”) 
 
WScript.Echo Env(“Path”) 
currentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
 
Env(“TODOR_BASE”) = currentDirectory

currentPath = Env(“Path”)
pos = InStr(currentPath,currentDirectory)
if pos=0 then
    Env(“Path”) = currentPath & “;” & currentDirectory
end if

WScript.Echo “Setup successfully!”