admin管理员组文章数量:1531532
2024年1月13日发(作者:)
方法一:批处理中,修改环境变量,一次性有效(也就是在当前的脚本中有效)CMD中运行set path==%path%;d:/mypath用 set path可以查看,当前的环境变量
方法二 :批处理中,修改环境变量,永久有效::更改path环境变量值,新增e:toolswmic ENVIRONMENT where "name='path' and username='
另外介绍些关于wminc的用法(简单又实用)
::获取temp环境变量wmic ENVIRONMENT where "name='temp'" get UserName,VariableValue::新增系统环境变量home,值为%HOMEDRIVE%%HOMEPATH%wmic ENVIRONMENT create name="home",username="
view plaincopy to clipboardprint?::检查path中有没有e:tools(有就跳到run,没有就接着执行)echo %path%|findstr /i "e:tools"&&(goto run)
::先添加,防止没有时修改出错wmic ENVIRONMENT create name="path",VariableValue="e:tools;%path%"::再修改,防止已有时添加出错
wmic ENVIRONMENT where "name='path' and username='
:runstart 程序.exe::检查path中有没有e:tools(有就跳到run,没有就接着执行)echo %path%|findstr /i "e:tools"&&(goto run)::先添加,防止没有时修改出错wmic ENVIRONMENT create name="path",VariableValue="e:tools;%path%"::再修改,防止已有时添加出错wmic ENVIRONMENT where "name='path' and username='
版权声明:本文标题:6、批处理,修改环境变量path的方法(加环境变量) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1705107144a123390.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论