0

This doesn't seem to be that hard, however, can't seem to get the output of a function call stuffed into a variable.

SET info=
call git log -6
REM echo %info%
echo { "timestamp": "%time% %date%", "info": "%info%" } >> ".\src\assets\build-info.json"

Some or a pointer in the right direction would be appreciated meaning.

1 Answer 1

1

I suggest to have your command output a more easily parseable output, and send it to a file.

You could then use for /f to read a the file line by line (even tokenize the lines) into a variable, then write the variable to a file.

for example:

git log --format="%aI | %an | %s" > git.log
(for /f "delims=| tokens=1-3" %a in (git.log) do @echo {"timestamp":"%a", "info":"%c"}) > git.log.json
Sign up to request clarification or add additional context in comments.

1 Comment

I actually had a solution a bit like (in mind) this only not as elegant. I will go ahead with your approach, grazie.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.