wmic添加环境变量会多出一些重复的内容

今天用wmic添加环境变量,批处理指令如下:

@echo off
set ls_var=%~dp0
wmic environment where (name="path" and username="<system>") set variablevalue="%ls_var%;%path%"


添加过之后,发现除了当前路径,在path最后,多出来一些重复的内容

这是path里面原来的内容

C:\Windows\system32;

C:\Windows;C:\Windows\System32\Wbem;

C:\Windows\System32\WindowsPowerShell\v1.0\;

C:\Program Files\Intel\WiFi\bin\;

C:\Program Files\Common Files\Intel\WirelessCommon\;

d:\Program Files\IDM Computer Solutions\UltraEdit;

C:\Program Files\Microsoft\Web Platform Installer\;

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;

C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;

C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\Program Files\IDM Computer Solutions\UltraCompare\;

C:\Program Files\TortoiseSVN\bin


接着是执行过批处理之后,path里面的内容

C:\Program Files (x86)\ivs\;

C:\Program Files (x86)\ivs6500ocx;

C:\Windows\system32;C:\Windows;

C:\Windows\System32\Wbem;

C:\Windows\System32\WindowsPowerShell\v1.0\;

C:\Program Files\Intel\WiFi\bin\;

C:\Program Files\Common Files\Intel\WirelessCommon\;

d:\Program Files\IDM Computer Solutions\UltraEdit;

C:\Program Files\Microsoft\Web Platform Installer\;

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;

C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;

C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;

D:\Program Files\IDM Computer Solutions\UltraCompare\;

C:\Program Files\TortoiseSVN\bin;

C:\Program Files\Intel\WiFi\bin\;

C:\Program Files\Common Files\Intel\WirelessCommon\;

D:\Program Files\IDM Computer Solutions\UltraCompare\

其中红色部分为执行后新增内容,虽然如愿将当前路径添加进去,但是后面多出来三个,这三个是哪里来的呢?

在网上查了半天也没查到原因,最后突然发现,其实这三个是用户变量里面的。

但是还有一个问题,虽然path添加了当前路径,但是不是立即生效的,需要重启、注销、或者进入环境变量,一路点确定,才会生效,这个一直没解决。

如果看到这篇文章,你有什么好的方法,欢迎留言,拜谢。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值