ShellExec

44 views
Skip to first unread message

Terry Rizzo

unread,
Mar 20, 2026, 2:08:56 AM (13 days ago) Mar 20
to inno...@googlegroups.com

Hello,

I am trying to launch a security key setup exe using a command window.

Using the following code generates an error: “The system cannot find the path specified”

  CommandStr := ExpandConstant('"{cmd}"');

  ParamStr := ExpandConstant(' /k ""{app}\System Driver\Sentinel System Driver Installer 7.6.1.exe"" /v ""/passive CONFIRMUPGRADE=TRUE REBOOT=ReallySuppress ADDLOCAL=ALL"");

  ShellExec( 'open', CommandStr, ParamStr, '""""', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);

If I just open a command window manually (as admin) and enter the following, it works as desired:

"C:\Program Files (x86)\Company\Application\System Driver\System Driver\Sentinel System Driver Installer 7.6.1.exe" /v "/passive CONFIRMUPGRADE=TRUE REBOOT=ReallySuppress ADDLOCAL=ALL"

I’m sure the problem is with the double quotes but I can’t seem to get the correct syntax.

Thanks for any help.

Best regards,

Terry

Terry RIZZO
R Cubed Software
820 Bunker Hill Ave.
Lawrenceville, NJ 08648 USA
mailto: t...@rcubedsw.com
Phone: 609-577-2811


Gavin Lambert

unread,
Mar 20, 2026, 2:12:56 AM (13 days ago) Mar 20
to innosetup
On Friday, March 20, 2026 at 7:08:56 PM UTC+13 Terry Rizzo wrote:

  ParamStr := ExpandConstant(' /k ""{app}\System Driver\Sentinel System Driver Installer 7.6.1.exe"" /v ""/passive CONFIRMUPGRADE=TRUE REBOOT=ReallySuppress ADDLOCAL=ALL"");

  ShellExec( 'open', CommandStr, ParamStr, '""""', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);

If I just open a command window manually (as admin) and enter the following, it works as desired:

"C:\Program Files (x86)\Company\Application\System Driver\System Driver\Sentinel System Driver Installer 7.6.1.exe" /v "/passive CONFIRMUPGRADE=TRUE REBOOT=ReallySuppress ADDLOCAL=ALL"

I’m sure the problem is with the double quotes but I can’t seem to get the correct syntax.

Try the full cmd /k on the command line until it works, then put that in.  You don't need any additional escaping since [Code] uses single quoted strings.

IIRC, this should be the correct syntax (cmd /c or /k is a bit weird with quote parsing):

Justyna Stanczyk

unread,
Mar 20, 2026, 2:16:43 AM (13 days ago) Mar 20
to inno...@googlegroups.com
Hi 

var
  InstallerPath: String;
  Params: String;
  ResultCode: Integer;
begin
  // Den Pfad zur EXE auflösen
  InstallerPath := ExpandConstant('{app}\System Driver\Sentinel System Driver Installer 7.6.1.exe');
  
  // Die Parameter (beachten Sie die doppelten "" für Anführungszeichen innerhalb des Strings)
  Params := '/v ""/passive CONFIRMUPGRADE=TRUE REBOOT=ReallySuppress ADDLOCAL=ALL""';

  // Erst prüfen, ob die Datei existiert
  if FileExists(InstallerPath) then
  begin
    // ShellExec ohne den Umweg über CMD (sauberer)
    if not ShellExec('open', InstallerPath, Params, '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('Fehler beim Starten des Installers. Fehlercode: ' + IntToStr(ResultCode), mbError, MB_OK);
    end;
  end
  else
  begin
    MsgBox('Der Installer wurde unter folgendem Pfad nicht gefunden: ' + InstallerPath, mbError, MB_OK);
  end;
end;

Good Day Justyna Stanczyk 

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/innosetup/002f01dcb7f0%24b5ba6d00%24212f4700%24%40rcubedsw.com.

Gavin Lambert

unread,
Mar 22, 2026, 7:04:00 PM (10 days ago) Mar 22
to innosetup
On Friday, March 20, 2026 at 7:16:43 PM UTC+13 Justyna Stanczyk wrote:
  // Die Parameter (beachten Sie die doppelten "" für Anführungszeichen innerhalb des Strings)
  Params := '/v ""/passive CONFIRMUPGRADE=TRUE REBOOT=ReallySuppress ADDLOCAL=ALL""';

You didn't post an actual question, but no, if you're not running this inside {cmd} /k any more then this is over-quoted.  Just use a single set of double-quotes, not two.
Reply all
Reply to author
Forward
0 new messages