I need a batch loop that should extract a data value and use it in its next command. All registry keys I want to query has been saved into a *.txt file.
Example:
The following command will return the key value, type and data as per below.
COMMAND:
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\01690987922DC9549A63529D22383DDF\InstallProperties /V UninstallString
RESULT:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\01690987922DC9549A63529D22383DDF\InstallProperties
UninstallString REG_EXPAND_SZ MsiExec.exe /X{78909610-D229-459C-A936-25D92283D3FD}
What I want to do is to extract only the data value MsiExec.exe /X{78909610-D229-459C-A936-25D92283D3FD}
and run it as my next command in the for loop.
I have roughly 20 registry keys that I want to query and then run the extracted command. I also want to add silent switches to the msiexec.exe command when it is executed.
I'm very new to batch loops and believe I need to use tokens/delims(?)... not really sure how to get it working.
cmd
is perfectly capable of such a trivial task ;) – DavidPostill♦ Mar 23 '16 at 18:54