1 var shell = WScript.CreateObject("WScript.Shell");
\r
2 var fs = new ActiveXObject("Scripting.FileSystemObject");
\r
4 var PATH_KEY = "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\Path";
\r
5 var path = shell.RegRead(PATH_KEY);
\r
6 var windrush = fs.GetParentFolderName(WScript.ScriptFullName)
\r
8 var inPath = path.toLowerCase().indexOf(windrush.toLowerCase()) != -1;
\r
10 WScript.Echo("Adding '" + windrush + "' to your PATH variable...");
\r
12 WScript.Echo("'" + windrush + "' is already in your PATH variable");
\r
15 shell.RegWrite(PATH_KEY, windrush + ";" + path, "REG_EXPAND_SZ");
\r
16 var oExec = shell.Exec(windrush + "\\tools\\bin\\notify_env_change.exe");
\r
17 while (oExec.Status == 0)
\r
19 if (oExec.ExitCode != 0)
\r
20 WScript.Echo("Failed to notify the system about PATH change. Reboot required");
\r
21 WScript.Echo("Done.");
\r
23 WScript.Echo("Could not write PATH variable to the registry.\nYou may have insufficient permissions to that. Try running this script as administrator");
\r