windows命令行永久增加环境变量

2024-10-12 17:10:04

1、新建一个path.vbsSet unNamedArguments = WScript.Arguments.UnNamedAdd霸烹钟爷Path(unNamedArguments.Item(0))Function AddPath(strPath)strComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colItems = objWMIService.ExecQuery( "Select * from Win32_Environment where name = 'PATH'")Found = FalseFor Each objItem in colItemsIf UCase(objItem.Name) = "PATH" Then Found = True objItem.VariableValue = objItem.VariableValue & ";" & strPath objItem.Put_ End IfNextEnd Function

windows命令行永久增加环境变量

3、把路径拖到set_path.bat 即可查看一下结果已经在这里了

windows命令行永久增加环境变量windows命令行永久增加环境变量windows命令行永久增加环境变量
猜你喜欢