:: 获取管理员权限
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"

@echo off  
wmic ENVIRONMENT where name="OSG_FILE_PATH2" delete
wmic ENVIRONMENT create name="OSG_FILE_PATH2",username="<system>",VariableValue="%~dp0"
taskkill /f /im explorer.exe
start explorer.exe
pause

脚本如上所示,

1.首先获得管理员权限;

2.删除环境变量,保证创建环境变量成功

3.创建环境变量

4.重启explorer.exe资源浏览器

相关文章:

  • 2021-06-07
  • 2022-02-20
  • 2022-12-23
  • 2022-01-22
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
猜你喜欢
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2022-03-14
  • 2021-07-19
相关资源
相似解决方案