This ended up being a path issue. I was using "path" as one of my variables elsewhere in the script without realizing that this actually edited the environment variable PATH.
Original question:
I am writing a batch file. In the batch file I have the following:
FOR /F "tokens=*" %%a IN ('git branch -r') DO CALL :SOMELABEL %%a
EXIT
:SOMELABEL
git status
START /B /WAIT CMD /C git status
FOR /F "tokens=*" %%n IN ('git status') DO ECHO %%n
GOTO :EOF
'git status' is just an example. Each of the 3 'git status' commands return "'git' is not recognized as an internal or external command, operable program or batch file."
Normally, this would be an environment variable issue (PATH), but what makes this unique is the fact that the first git command works ("git branch -r"). I have maybe 5 other batch files that can use the git command successfully as well. Any ideas as to why the later git commands won't work in the code above?
If it's due to a permissions issue (like can't execute another git command while one is in progress sort of thing), any idea how I might make this script work (preferably without having to make a temporary file)? Or is making a temp file for the output of the first command the only way?