Skip to content
⌘ NSIS Forum Archive

How to pass empty string as macro parameter?

3 posts

WindBridges#

How to pass empty string as macro parameter?

For example
!macro TestMacro param1 param2
Push param1
Push param2
!macroend

!insertmacro TestMacro "" "test"
this code raises an error - Push expects 1 parameters, got 0. It happens because param1 is replaced by nothing, in result we have Push call without any parameters. How do you resolve this problem?
Afrow UK#
!macro TestMacro param1 param2
Push `${param1}`
Push `${param2}`
!macroend
Use quotes around the values (` is recommended because ' and " are more commonly used within strings).

Stu