I have scripted AddPath.vbs to add a folder to the system path.
The syntax for using AddPath.vbs is:
cscript //nologo <Drive:>\ScriptPath\AddPath.vbs Folder
Where Folder is the folder path you wish to add, like C:\Util or "C:\Program Files\Log Parser 2.2".
AddPath.vbs contains:
Dim oArgs Set oArgs = WScript.Arguments if oArgs.Count 1 Then Wscript.Echo "Syntax: cscript //nologo AddPath.vbs Folder" if oArgs.Count 1 Then Wscript.Quit NewFold = oArgs(0) strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_Environment Where Name = 'Path'") For Each objItem in colItems strPath = objItem.VariableValue & ";" & NewFold objItem.VariableValue = strPath objItem.Put_ Next
0 comments
Hide comments