Thank you for trying to convince me that
atfon wrote: ↑
07 Dec 2021 08:08
I'm attempting what should be a relatively simple task. I'm generating a list of installed 64-bit application
was completely irrelevant, regardless of your failure to do so
If it wasn't relevant, why include it at all, your question would simply have read, how do I count the number of results returned from my 'for' loop?
Whilst kind of irrelevant, the command that you are using, already has a method of telling you how many matches were returned. For example:
Code: Select all
@Set "numApps=" & For /F "Tokens=1,* Delims=:" %%G In ('%__APPDIR__%reg.exe Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S /F "DisplayName" /V 2^>NUL') Do @Set /A numApps = %%H 2>NUL
Please note however, that I doubt that each item listed is 64-bit, even on a 64-bit OS, and conversely that only those under 'HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' are only x86. Also your code makes no attempt at determining whether it is running already from a 64-bit process, and may therefore, on a 64-bit OS, not have direct access to the subkeys you're trying to read.