Archive: Write "$1" as the value of a registry key


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?


$$1.

Stu


Thank you,


should be
"$INSTDIR\QuickShortcut.exe $\"$1$\""
if $1 contains spaces, eg path


Shouldn't that be $\"$$1$\"" , then?


Yes, or how about: `"$INSTDIR\QuickShortcut.exe" "$$1"`?

Stu


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.

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...

$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.