nsismat
22nd March 2012 20:51 UTC
Write "$1" as the value of a registry key
Hello,
I've been trying to figure out how to write "$1" to the registry key without luck.
I want the value of my key to be "...QuickShortcut.exe $1", unfortunately the $1 is seen as a variable and it doesn't work.
WriteRegStr HKCR "*\shell\QuickApp\command" "" "$INSTDIR\QuickShortcut.exe $1"
Any suggestions?
Afrow UK
22nd March 2012 21:30 UTC
$$1.
Stu
nsismat
22nd March 2012 21:43 UTC
Thank you,
Brummelchen
26th March 2012 17:02 UTC
should be
"$INSTDIR\QuickShortcut.exe $\"$1$\""
if $1 contains spaces, eg path
MSG
26th March 2012 21:16 UTC
Shouldn't that be $\"$$1$\"" , then?
Afrow UK
26th March 2012 21:55 UTC
Yes, or how about: `"$INSTDIR\QuickShortcut.exe" "$$1"`?
Stu
Brummelchen
31st March 2012 12:41 UTC
erm - NO - should not $$1 - cause it already was treated as text in ""
this one puts "blabla"
;--------------------------------
;Configuration
SetCompressor /SOLID LZMA
ShowInstDetails nevershow
AutoCloseWindow true
OutFile "test.exe"
;--------------------------------
Section ""
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
StrCpy $1 "blabla"
WriteRegStr HKCR "*\$1\command" "" "$\"$1\$1$\" $\"$1$\""
Messagebox MB_OK "Keypress"
DeleteRegKey HKCR "*\$1"
Quit
FunctionEnd
;--------------------------------
with $$1 it puts "$1\$1" "$1" which is wrong.
$$ is used if you want to write the number or string of variable
eg messagebox mb_ok "value $$R9: '$R9'"
similar to \\ in dialogs with input boxes.
MSG
31st March 2012 13:23 UTC
Originally posted by Brummelchen
$$ is used if you want to write the number or string of variable
Yes, and that's exactly what this thread is about...
Brummelchen
31st March 2012 16:21 UTC
$1 is a nsis variable - i dont thinks this was purpose.
otherwise typo and it should have been %1 as a context variable of windows
$$1 makes neither nor sense.