使用bat文件设置系统变量 [英] Setting system variables using bat file

查看:82
本文介绍了使用bat文件设置系统变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个bat文件来在任何Windows系统上设置系统变量.我制作的软件需要设置路径,而不是要求用户处理我听说可以使用bat文件完成此任务的方法,因此我尝试了多种设置路径螺母的方法,其中大多数都是所有现有路径的副本,而不是添加新路径,有时会删除所有路径,仅保留新路径

I wanna write a bat file to set system variables on any windows system. My software which I made needs to set a path instead of asking the user to process the method I heard we can do this task using bat files so I tried multiple ways to set a path nut most of them are duplicates of all existing paths instead of adding new ones and some times it's removing all paths and keeping only the new path

setx Path "%Path%;c:\ffmpeg"

它正在复制所有现有的路径变量

which is duplicating all the existing path variable

我确实阅读了多个Stackoverflow查询,但没有一个帮助如果您在系统上进行测试以检查请先保存/制作所有路径的副本
谢谢埃斯瓦尔(Eswar)

I did read multiple Stackoverflow queries on this but none helped if ur testing on your system to check please save/make a copy of all ur paths first
Thank you Eswar

推荐答案

我不建议您弄乱系统变量,但是如果您要存储使用cmd的路径

I don't suggest you mess with system variables but if you want to store path from cmd use

setx Path "%Path%;C:\your\path\here\" C:\ffmpeg\bin

我在Windows 10上测试了它对我有用
希望它也对你有用!

I tested on windows 10 it worked for me
Hopefully it works for u too!!

这篇关于使用bat文件设置系统变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆