| 1. |
Solve : Help with REG QUERY to variable? |
|
Answer» Hello, guys. You declare 3 tokens, yet you only use the first token of three. (%%i) What do %%j and %%k contain?Sorry for bumping, I thought that no one had seen the topic. If you run REG QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /V "Inno Setup: App Path" you will get: Code: [Select]HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setu p 5_is1 Inno Setup: App Path REG_SZ C:\Program Files\Inno Setup 5 I just want to use the install path of Inno Setup and set it as a variable in order to use it later. Thanks for your patience and help!1. You know that the reg query output will be like this HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1 Inno Setup: App Path REG_SZ C:\Program Files\Inno Setup 5 2. You know: a. You want the second line of the output. b. The second line will be in an expected format c. The second line has 5 space-delimited tokens before the text that you want. assuming: "tokens=1-5* delims= " Inno Setup: App Path REG_SZ C:\Program Files\Inno Setup 5 1 2 3 4 5 * %%a %%b %%c %%d %%e %%f 3. Use FIND to isolate the 2nd line which CONTAINS "App Path" 4. Use "tokens=1-5* delims= " to put the path into the 6th token (asterisk means EVERYTHING after the 5th token) So try this... set RegCommand=reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" FOR /f "tokens=1-5* delims= " %%a in ( ' %RegCommand% ^| find "App Path" ' ) do set InnoSetupPath=%%f Thank you for your detailed explanation. I think I got it one and for all. But, in XP it doesn't work. Code: [Select]reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" ! REG.EXE VERSION 3.0 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setu p 5_is1 Inno Setup: App Path REG_SZ C:\Program Files\Inno Setup\Inno Setup 5 It sets InnoSetupPath=Setup\Inno Setup 5. So I deleted the delims= and it works in Vista and in XP. I don't know if it's COMPLETELY right what I did though. Again, thank you very much for your help!Quote from: Chem4 on February 26, 2009, 03:39:54 PM I deleted the delims= and it works in Vista and in XP. I don't know if it's completely right what I did though. If it works, it must be. I was guessing about the delims, as I do not have Inno Setup on my PC. |
|