i'm trying to loop through all installed programs:
wmic /output:C:\temp\InstallList.txt product get name
for /F "tokens=*" %%G in (C:\temp\InstallList.txt) do echo %%G
the file is created, but the output is empty!
The output is not empty. The output is in Unicode. Use more
to convert into current local encoding.
If you would like the whitespace removed from the end of the strings, see How to remove trailing and leading whitespace for user-provided input in a batch file?
setlocal enabledelayedexpansion
wmic product get name | more >"C:\temp\InstallList.txt"
for /F "skip=1 usebackq tokens=*" %%G in (`type "C:\temp\InstallList.txt"`) do (
set S=%%G
set S=!S:~0,-1!
if "!S!" NEQ "" (echo !S!)
)