Skip to content
⌘ NSIS Forum Archive

/? on the command line

20 posts

arunrajaredpine#

/? on the command line

Hi all,
I have created installer using NSIS script.If i run this .exe file using following command not working: mysetup.exe /? .This installs the setup instead of showing help.

Please anyone text me the solution.

Thanks in advance.
JasonFriday13#
Installer usage is in the docs: http://nsis.sourceforge.net/Docs/Cha...installerusage.
arunrajaredpine#
Hi,
I tried that one already.But not working.If i execute mysetup.exe from command line,it will always installing the setup.Whether we have to add something in script?
JasonFriday13#
Come on, source code is available on the download page for NSIS: http://nsis.sourceforge.net/Download.

Do you really need the /? command line option? Is it worth the trouble of adding it to the installer?
arunrajaredpine#
Ya i need /? command.I want to run normal installation,silent one and have to extract particular folder.Above all these have to do from command line like:/S,/extract
arunrajaredpine#
I have downloaded that source file.There are many sample scripts available.But i dont know which one for my requirement.I tried above all exe files from /? command,but nothing has showing help prompt.
arunrajaredpine#
NSIS Language prompt after /S command

Hi,
I have added additional languages to my installer.If i run this .exe file using /S (silnet) command,it showing language selection dialogbox.If it is single language it wont showing any dialog boxs.
Please tell me the solution for silent install if it is multi language supported?
arunrajaredpine#
Hardware Id not taking

Hi,
InstDrv::InitDriverSetup /NOUNLOAD "{4d36e972-e325-11ce-bfc1-08002be10318}" "USB\VID_1618&PID_9113".
Above Line is executing successfully.But Driver is not installed.I thought '\' maybe path,that why it's not taking.
:CreateDevice:E00000205(Error message).So the device not created successfully.

Is there anyway to clear this?What can i do for take my hardware ID as it is.

Please help me anyone...
Thanks in advance.
Anders#
!include LogicLib.nsh

Function .onInit
${IfNot} ${Silent}
LangDll::Something
${EndIf}
FunctionEnd
I don't know anything about the driver issue but this thread is not the place to ask.
rajansis#
How to use if statement for macro

Hi all,
Aik We can use !ifdef outside of the function or section.Here,I am getting the command line arguments in $R0.But If i execute the .exe file created by the following script with "Command /? (.exe /?)" not showing "welcomepage".That "/?" is defined during run time.My intention is if i execute the .exe file with "/?" command should show the "WELCOMEPAGE",and other commands should not.Can anyone tell me the solution?.Just see the ifdef function.


-----------------------------
outfile "ifdef.exe"
!include "MUI.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"

function .oninit
${getparameters} $R0
functionend

!define $R0

!ifdef /?
!insertmacro MUI_PAGE_WELCOME
!endif

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

section
.......
sectionend

-----------------------------
JasonFriday13#
No, you can't mix compile time commands and runtime commands like that. $R0 is only available at runtime, but you are feeding that to a compile time command.
JasonFriday13#
One work around is to do it all at runtime, like this:
Name "test1"
OutFile "test1.exe"
RequestExecutionLevel user
!include "MUI2.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
Function .oninit
  ${getparameters} $R0
FunctionEnd
!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePre
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Function WelcomePre
  StrCmp $R0 "/?" +2
  Abort
FunctionEnd
Section
SectionEnd 
rajansis#
Hi,
Actually i have to create .exe file,which is for installation (both silent and normal). And if i run this .exe file from command line:1.If silent "/S" and if "/?" is for Help.But following code not working properly.i.e., If i run " .exe /? " command showing "Help", after that again it showing welcome box ,installing and finish page.

NOTE:We can do that one if we use abort or quit after message box (same as following code).But i should not use ABORT in complete code.


!include "MUI.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!define MUI_ICON "C:\Users\test\Music\OneBox\NSIS.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Russian"

Function lang
Push ""
Push ${LANG_ENGLISH}
Push English
Push ${LANG_Korean}
Push Korean
Push ${LANG_French}
Push French
Push ${LANG_German}
Push German
Push ${LANG_Italian}
Push Italian
Push ${LANG_Japanese}
Push Japanese
Push ${LANG_Spanish}
Push Spanish
Push ${LANG_Russian}
Push Russian

Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"

Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
FunctionEnd


Function .onInit
${GetParameters} $8

${if} "$8" == "/S"
Goto done

${elseif} "$8" == ""
call lang
goto done

${else}
call help

${endif}
done:
FunctionEnd

InstallDir "c:\OneBox"
Name "OneBox"

section main
InstDrv::InitDriverSetup /NOUNLOAD "{4d36e978-e325-11ce-bfc1-08002be10318}" "ircomm2k"
Pop $0
DetailPrint "InitDriverSetup: $0"

InstDrv:😁eleteOemInfFiles /NOUNLOAD
Pop $0
DetailPrint "DeleteOemInfFiles: $0"
StrCmp $0 "00000000" PrintInfNames ContInst1

PrintInfNames:
Pop $0
DetailPrint "Deleted $0"
Pop $0
DetailPrint "Deleted $0"

ContInst1:
InstDrv::CreateDevice /NOUNLOAD
Pop $0
DetailPrint "CreateDevice: $0"

InstDrv::InstallDriver /NOUNLOAD "c:\OneBox\ircomm2k.inf"
Pop $0
DetailPrint "InstallDriver: $0"
StrCmp $0 "00000000" PrintReboot ContInst2

PrintReboot:
Pop $0
DetailPrint "Reboot: $0"

ContInst2:
InstDrv::CountDevices
Pop $0
DetailPrint "CountDevices: $0"

sectionEnd

function help
MessageBox MB_OK "Valid Commands:$\n/S$\t = Silent install$\n/S extract=$\t = Extract files$\n/?$\t = This help page.$\n"
abort
functionend