Question

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 external 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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top