Old 18th June 2019, 23:10   #1
shortyg83
Junior Member
 
Join Date: Jun 2019
Posts: 1
Script to only install if folder exists

I am making a file to install patches on 5 computers. Two of the computers have software that the other three don't and I need it to stay that way.
How can I script so that it only runs a certain executable in the service pack if a certain folder or file already exists on the pc. And if that folder or file does not exist it skips that exe from the service pack.
shortyg83 is offline   Reply With Quote
Old 18th June 2019, 23:12   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,142
PHP Code:
!include LogicLib.nsh

Section
${If} ${FileExists"$ProgramFiles32\Company\MyApp\App.exe"
    
InitPluginsDir
    File 
"/oname=$PluginsDir\MyAppPatch.exe" "c:\mysourcefiles\MyAppPatch.exe"
    
ExecWait '"$PluginsDir\MyAppPatch.exe"' Maybe supply the "$ProgramFiles32\Company\MyApp" path as a parameter?
    
Delete "$PluginsDir\MyAppPatch.exe"
${EndIf}
SectionEnd 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump