Announcement

Collapse
No announcement yet.

Need help with ExecWait and/or ExecShell

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with ExecWait and/or ExecShell

    Hey!

    I'm creating an installer and as we finish copying files, prompt install for some prerequisites, we want to execute a couple of powershell scripts (.ps1 extension)
    One is a single string replacement script, which works fine with ExecWait.
    ExecWait 'powershell.exe -file "$INSTDIR\replace.ps1" "$ConnStr" "$INSTDIR"'

    So that works very nicely.

    ExecShell "" "$INSTDIR\replace.ps1" '/param1="$ConnStr" /param2="$INSTDIR"' SW_SHOWNORMAL

    I tried this a multitude of ways and parameters never get passed, this is just the latest.
    The first one I have tried:
    ExecShell "" "$INSTDIR\replace.ps1" '"$ConnStr" "$INSTDIR"' SW_SHOWNORMAL

    I have tried with "open", does the same as the empty one, with "runas" it doesn't even execute.
    How am I supposed to pass multiple parameters with ExecShell?
    Bonus question: Does it run 32bit or 64bit powershell? Does it run the "default"? whatever that is

    I've googled for a couple hours now and checked docs of course but it didn't help out enough

  • #2
    Why do you want to use ExecShell? The default handler for a .ps1 file might be a text editor! ExecShell does usually not support parameters for things that are not .exe files.

    You can also do
    PHP Code:
    nsExec::Exec 'powershell -inputformat none -ExecutionPolicy RemoteSigned -File "$InstDir\myFile.ps1"'
    Pop $R0 ; exit code 
    IntOp $PostCount $PostCount + 1

    Comment


    • #3
      I see, we really need to use the parameters.
      We went back to ExecWait, and it seems the problem was actually 64bit redirection and turning it off solved our problems for now.
      Thank you for the reply!

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎