问题
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:
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"
来源:https://stackoverflow.com/questions/24899470/appending-in-a-windows-batch-script