开发者

windows command config file?

开发者 https://www.devze.com 2023-04-09 23:54 出处:网络
I\'m running a few different windows command scripts that all reference the same directory. The directory I want to reference changes from day to day depending on what I\'m working on. I\'ve looked in

I'm running a few different windows command scripts that all reference the same directory. The directory I want to reference changes from day to day depending on what I'm working on. I've looked into taking command line args, but I think the more elegant solution would be to have all the scripts reference some sort of config file, if such a thing is possible. Then I could change the directory address one place to change all of my standard command scripts. If it's not abundantly clear, I'm new to windows scripting.

Q: Is there a way to retrieve data from an extern开发者_开发知识库al config in a windows command script?

PS - Don't be limited by my question, if you think you have a better solution for what I'm trying to do, I'm all ears.


The simplest thing would be to use an environment variable.

eg:

set my_path=c:\foo\bar

then in the script you can use %my_path% and it will be expanded for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号