First hi to everyone !
I want to create a shortcut to a batch file that does not prompt the DOS window. For that I have seen that the following command works very well:
wscript.exe invisible.vbs my_batch_file.bat
My problem is that I would like to create the shortcut with this command via CMake and NSIS. My problem is that it seems I cannot give more than one parameter after "wscript.exe" in the following command in the CMakeLists.txt file:
list(APPEND CPACK_NSIS_CREATE_ICONS "
CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\link.lnk' 'wscript.exe' 'invisible.vbs my_batch_file.bat' icon.ico 0 SW_SHOWMINIMIZED
")
And the space between "invisible.vbs" and "my_batch_file.bat" is not parsed as I expected (i.e. as a space...). Could anyone help me with this ? Thanks a lot for every comment (method or code hint) !
I solved my problem using the "NSIS.template.in" file, in which I created the following macro
!macro CreateShortcutBat link bat_file
CreateShortCut '$SMPROGRAMS\\$STARTMENU_FOLDER\\${link}' 'wscript.exe' 'invisible.vbs ${bat_file}' icon.ico 0 SW_SHOWMINIMIZED
!macroend
Then in my CMakeLists.txt file, I only need to call the macro this way:
list(APPEND CPACK_NSIS_CREATE_ICONS "
!insertmacro CreateShortcutBat 'Shortcut.lnk' 'my_batch_file.bat'
")