Relate to this question.
I want to run cl.exe
from git bash on windows. Usually you need the developer prompt to do this, so I do this instead:
cmd //V //K "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
Which opens the developer prompt as a sub-shell. From there I can run cl
if I want.
However, it would be nice if I could run commands from git bash without going into the subshell. I would be happy with either:
Somehow "
source
ing" theVsDevCmd.bat
file to export the variables it sets as variables in the environment, so I can runcl
from bash, orchanging the
//K
to a//C
and changing to the current (bash) working directory, then executingcl
with any arguments forwarded. Bonus points if it's an alias.
Can't figure out #1 at all.
I need help with the syntax on #2 because while
cmd //V //C "C:\Program Files (x86)\...\VsDevCmd.bat"
works in the sense that it executes the batch script and immediately exits, I don't know how to chain several commands together. Running
cmd //V //C "C:\Program Files (x86)\...\VsDevCmd.bat & cl"
for instance, gives
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
How can I execute cl.exe
from git bash directly, without needing in a separate prompt?