I am trying to format the output of a command in JSON as such:
echo "patches" : {
set patches="wmic qfe get HotfixID"
for /f "skip=1" %%i in (' %patches% ') do (
set /a count=count+1
call echo "!count!" : "%%i",
)
echo }
Everything is fine until I hit the end of the list of patches where it reads the line after the last patch and then prints ""
.
How can I make it stop when it is supposed to?
If possible, I would like to avoid using text files.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…