I have been trying the following piece of code on a Windows 7 x64 machine for some time and it just doesn't work.
The Notepad.exe can be located but not dpinst.exe although it is very much present in the directory.
I could also make do with just "IfFileExists" ... that doesn't work either! 🙁 🙁
!include "LogicLib.nsh"
Name "Example1"
OutFile "example1.exe"
InstallDir $DESKTOP\Example1
# Added by me
RequestExecutionLevel highest
Page directory
Page instfiles
Var /GLOBAL fname
Section ""
SetOutPath $INSTDIR
MessageBox MB_OK "SYSDIR: $SYSDIR"
;StrCpy $fname "$SYSDIR\notepad.exe"
StrCpy $fname "$SYSDIR\dpinst.exe"
${If} ${FileExists} $fname
MessageBox MB_OK "1"
${Else}
SearchPath $0 dpinst.exe
${If} ${FileExists} $0
MessageBox MB_OK "2"
${Else}
MessageBox MB_OK "3"
${EndIf}
${EndIf}
SectionEnd ; end the section
Any help would be appreciated, thanks!
Regards,
Shantanu