0
我試圖獲取WMIC命令的輸出以將變量分配給每一行。來自txt文件的wmic變量
我試圖讓出來放到這個樣子:
1第一程序安裝的
2秒程序安裝的
3第三程序安裝的安裝
4第四種方案
5 ...等
@Echo off
wmic /output:file.txt product get name /format:csv
rem wmic product get name
@Echo Off
SetLocal EnableDelayedExpansion
Set n=
Set _InputFile=c:\users\jorge\desktop\file.txt
For /F "tokens=*" %%I IN (%_InputFile%) DO (
Set /a n+=1
Set _var!n!=%%I
)
:: This line will display the variables just assigned
:: For testing only, delete when not needed
Set _
EndLocal
pause