I have a batch file which is attempting to run the following:
FOR /F "tokens=1" %%G IN ('git show --pretty="format:" --name-only 54173344ab18a7d8e9ff2614cca62b671c8c7e2a') DO echo %%G
Which results in the git error ��fatal: Invalid object name 'format'
.
However if I simply place the command itself in a batch file, I get output I expect.
git show --pretty="format:" --name-only 54173344ab18a7d8e9ff2614cca62b671c8c7e2a
Produces:
Files/MyFiles/header.html
Files/MyFiles/foo.html
The issue is something to do with the quotes around "format:"
.
I've tried escaping them using ""
, to no avail. I also tried ^
. I've tried using the usebackq
parameter.
This loop also works if you take out the --pretty="format:"
argument, but then I get a bunch of extra text inserted.
FOR /F "usebackq tokens=1...
and then use backticks around yourgit
command. The backticks are like the single quotes you currently have, but lean the other way. – Leftover=
character in the command, e.g.--pretty^="format:"
. Otherwise I think it's OK. – Keetercdb cmd /c test.cmd
) and set a breakpoint (bp kernel32!CreateProcessW
) to inspect the command line that spawns the child (2nd x64 parameter:du @rdx
). – Keeter