Reputation: 79
What I would like to do is create a batch file that will temporarily add a environment variable to the Python executable. From there call the executable and open another script from the batch file. I'm very new to batch and have been researching this, so far I've found that to add a environment variable I would need something like:
set env="path/to/exe"
And to call a script I would need to use:
call "path/to/script"
My question being, if I where to combine the two two and then call the script, would I be able to do something like this:
set env="python.exe"
call "python script.py"
Will this work like I would expect it to?
Upvotes: 1
Views: 2488
Reputation: 504
Well the CALL
is used for calling (opening) batch files. If you wanted to open a python script through batch (and set the environment) you would have use the START
command and code it like this:
set env=python.exe
start python script.py
This should work (combined) if you have the Python environment.
Upvotes: 2