\H{instr} Instructions \S1{basicinstructions} Basic Instructions The instructions that NSIS uses for scripting are sort of a cross between PHP and assembly. There are no real high level language constructs, but the instructions themselves are (for the most part) high level, and you have handy string capability (i.e. you don't have to worry about concatenating strings, etc). You essentially have 25 registers (20 general purpose, 5 special purpose), and a stack. \S2{delete} Delete \c [/REBOOTOK] file Delete file (which can be a file or wildcard, but should be specified with a full path) from the target system. If /REBOOTOK is specified and the file cannot be deleted then the file is deleted when the system reboots -- if the file will be deleted on a reboot, the reboot flag will be set. The error flag is set if files are found and cannot be deleted. The error flag is not set from trying to delete a file that does not exist. \c Delete $INSTDIR\somefile.dat \S2{exec} Exec \c command Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used for the working directory. The error flag is set if the process could not be launched. Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: Exec '"$INSTDIR\\command.exe" parameters'. If you don't put it in quotes it will \e{not} work on Windows 9x with or without parameters. \c Exec '"$INSTDIR\someprogram.exe"' \c Exec '"$INSTDIR\someprogram.exe" some parameters' \S2{execshell} ExecShell \c action command [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE] Execute the specified program using ShellExecute. Note that action is usually "open", "print", etc, but can be an empty string to use the default action. Parameters and the show type are optional. $OUTDIR is used for the working directory. The error flag is set if the process could not be launched. \c ExecShell "open" "http://nsis.sf.net/" \c ExecShell "open" "$INSTDIR\readme.txt" \c ExecShell "print" "$INSTDIR\readme.txt" \S2{execwait} ExecWait \c command [user_var(exit code)] Execute the specified program and wait for the executed process to quit. See Exec for more information. If no output variable is specified ExecWait sets the error flag if the program executed returns a nonzero error code, or if there is an error. If an output variable is specified, ExecWait sets the variable with the exit code (and only sets the error flag if an error occurs; if an error occurs the contents of the user variable are undefined). Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: ExecWait '"$INSTDIR\\command.exe" parameters'. If you don't put it in quotes it will \e{not} work on Windows 9x with or without parameters. \c ExecWait '"$INSTDIR\someprogram.exe"' \c ExecWait '"$INSTDIR\someprogram.exe"' $0 \c DetailPrint "some program returned $0" \S2{file} File \c [/nonfatal] [/a] ([/r] [/x file|wildcard [...]] (file|wildcard) [...] | /oname=file.dat infile.dat) Adds file(s) to be extracted to the current output path ($OUTDIR). \b Note that the output file name is $OUTDIR\\filename_portion_of_file. \b Use /oname=X switch to change the output name. X may contain variables and can be a fully qualified path or a relative path in which case it will be appended to $OUTDIR set by \R{setoutpath}{SetOutPath}. When using this switch, only one file can be specified. If the output name contains spaces, quote the entire parameter, including /oname, as shown in the examples below. \b Wildcards are supported. \b If the /r switch is used, matching files and directories are recursively searched for in subdirectories. If just one path segment is specified (e.g. \c{File /r something}), the current directory will be recursively searched. If more than one segment is specified (e.g. \c{File /r something\\*.*}), the last path segment will be used as the matching condition and the rest for the directory to search recursively. If a directory name matches, all of its contents is added recursively. Directory structure is preserved. \b Use the /x switch to exclude files or directories. \b If the /a switch is used, the attributes of the file(s) added will be preserved. \b The File command sets the error flag if overwrite mode is set to 'try' and the file could not be overwritten, or if the overwrite mode is set to 'on' and the file could not be overwritten and the user selects ignore. \b If the /nonfatal switch is used and no files are found, a warning will be issued instead of an error. \c File something.exe \c File /a something.exe \c File *.exe \c File /r *.dat \c File /r data \c File /oname=temp.dat somefile.ext \c File /oname=$TEMP\temp.dat somefile.ext \c File "/oname=$TEMP\name with spaces.dat" somefile.ext \c File /nonfatal "a file that might not exist" \c File /r /x CVS myproject\*.* \c File /r /x *.res /x *.obj /x *.pch source\*.* \\Note:\\ when using the \e{/r} switch, both matching directories and files will be searched. This is always done with or without the use of wildcards, even if the given path perfectly matches one directory. That means, the following directory structure: \c