问题描述
我想编写一个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 helpedif ur testing on your system to checkplease save/make a copy of all ur paths first
Thank youEswar
推荐答案
我不建议您弄乱系统变量,但是如果您要存储使用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文件设置系统变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!