Appending in a Windows Batch Script

2019-09-17 23:08发布

I'm trying to write all the programs on a computer, and APPEND those programs names to the text in the 'programs.txt' file. Right now, the code is deleting the current text and putting the program names in the text file. I would like it to append the program names, so if anyone knows how to adjust the below code to append, I'd appreciate the info.

wmic /output:C:\Users\Jerry\Desktop\programs.txt product get name,version

1条回答
放我归山
2楼-- · 2019-09-17 23:49

Try like this :

wmic product get name,version >>"C:\Users\Jerry\Desktop\programs.txt"

A better solution will be to do it in 2 steps (cause of the Unicode output of WMIC) :

wmic /output:C:\Users\Jerry\Desktop\temp.txt product get name,version
type "C:\Users\Jerry\Desktop\temp.txt">>"C:\Users\Jerry\Desktop\programs.txt"
查看更多
登录 后发表回答