View Single Post
Old 3rd April 2020, 16:16   #1
ikreb
Junior Member
 
Join Date: Aug 2018
Posts: 14
Can't execute a executable with exec

Hello,

I try to execute a exe. I tried: nsExec::ExecToStack, nsExec::Exec, ExecWait, ExecShell. But I get each time as return value "error". So I don't know actually what the error could be.

But if I run the exe with cmd it works.

code:

SetCompress auto
SetCompressor lzma
CRCCheck on
ManifestDPIAware true

;======================================================
; General

Unicode true
ManifestSupportedOS all

; Name and file
Name "Installer"

OutFile "Fortinet_Installer.exe"

; Request application privileges for Windows
RequestExecutionLevel admin

;======================================================
; Imports

!include LogicLib.nsh
!include WinVer.nsh
!include WordFunc.nsh
!include x64.nsh

;======================================================
; Variables

Var Platform

;======================================================
; Functions

Function .onInit
InitPluginsDir

; CWD setzen
SetOutPath "$TEMP\Test-Installer"

${If} ${IsNativeAMD64}
StrCpy $Platform "x64"
File FortiClientVPNSetup_x64.exe
${ElseIf} ${IsNativeIA32}
StrCpy $Platform "x86"
File FortiClientVPNSetup_x86.exe
${ElseIf} ${IsNativeARM64}
; Install ARM64 64-bit driver/library
Abort "Unsupported CPU architecture!"
${Else}
Abort "Unsupported CPU architecture!"
${EndIf}

DetailPrint 'CPU architecture "$Platform" recognized.'
FunctionEnd


;======================================================
; Sections

Section

DetailPrint '"Run $TEMP\FortiClientVPNSetup_$Platform.exe /quiet /norestart"'
nsExec::ExecToStack '"$TEMP\FortiClientVPNSetup_$Platform.exe" /quiet /norestart'
Pop $0
Pop $1
DetailPrint '"$0"'
DetailPrint '"$1"'

SectionEnd




You could get the executable from here.
ikreb is offline   Reply With Quote