我想通过Windows注册表中的NSIS读出我的应用程序名称。
应用程序名称可以是“Application(x86)”或“Application(x64)”
我正在使用以下代码:
ReadRegStr $R1 HKLM "SOFTWARE\Something\Something\" "ApplicationName"
$R1
值的输出始终为“应用”,不带括号。
ReadRegStr
是否始终忽略特殊字符?
是有一些解决方法吗?
答案 0 :(得分:1)
ReadRegStr不会以任何方式过滤字符串:
Section
; Write the test string first
WriteRegStr HKCU "Software\NSIS\Test\" "Application" "Application (x86)"
; ...and then read it and display the result
ReadRegStr $R1 HKCU "Software\NSIS\Test\" "Application"
MessageBox MB_OK "$R1"
; Cleanup
DeleteRegKey HKCU "Software\NSIS\Test\"
SectionEnd
是否有可能是因为注册表重定向/反射或32对64位视图导致在注册表中的错误位置读取旧字符串?
使用Process Monitor监视安装程序,以便您可以看到正在读取的注册表中的实际位置以及返回给应用程序的值。