Appending in a Windows Batch Script

别等时光非礼了梦想. 提交于 2019-12-11 18:46:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!