Reference/IfFileExists: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Created page with "=IfFileExists= file_to_check_for jump_if_present [jump_otherwise] Checks for existence of file(s) file_to_check_for (which can be a wildcard, or a directory), and [[Reference/...")
 
Line 3: Line 3:
  file_to_check_for jump_if_present [jump_otherwise]
  file_to_check_for jump_if_present [jump_otherwise]


Checks for existence of file(s) file_to_check_for (which can be a wildcard, or a directory), and [[Reference/Goto|Goto]]s jump_if_present if the file exists, otherwise [[Reference/Goto|Goto]]s jump_otherwise. If you want to check to see if a file is a directory, use IfFileExists DIRECTORY\*.*
Checks for existence of file(s) file_to_check_for (which can be a wildcard, or a directory), and [[Reference/Goto|Gotos]] jump_if_present if the file exists, otherwise [[Reference/Goto|Gotos]] jump_otherwise. If you want to check to see if a file is a directory, use IfFileExists DIRECTORY\*.*


<highlight-nsis>IfFileExists $WINDIR\notepad.exe 0 +2
<highlight-nsis>IfFileExists $WINDIR\notepad.exe 0 +2
MessageBox MB_OK "notepad is installed"</highlight-nsis>
MessageBox MB_OK "notepad is installed"</highlight-nsis>

Revision as of 19:02, 27 November 2011

IfFileExists

file_to_check_for jump_if_present [jump_otherwise]

Checks for existence of file(s) file_to_check_for (which can be a wildcard, or a directory), and Gotos jump_if_present if the file exists, otherwise Gotos jump_otherwise. If you want to check to see if a file is a directory, use IfFileExists DIRECTORY\*.*

IfFileExists $WINDIR\notepad.exe 0 +2
MessageBox MB_OK "notepad is installed"