I have a program the launches a cmd console with a certain environment. The problem the console is launched by clicking a button, so I can’t create a custom launcher on my own with that environment.
What I want:
Given a file with a set variables (generated by running set command in the custom launched cmd), I want to set up the environment in the current cmd console by reading that file.
Example:
in.txt (note the spaces in same vars on the right side):
var1=c:\program files
path=c:\;c:\bin
var2=d:\folder with libs
After running the script like: ./script.sh in.txt the environment in the current cmd console should be (output after running set command):
var1=c:\program files
path=c:\;c:\bin
var2=d:\folder with libs
Note: bash scripting can be used inside the script as long as the environment is set right.
I have manged to write the following working script:
Creates a backup file envbkp.bat with environment variables before deleting them for possible restore