Executing files in your update
Executing files as part of your update is simple. You can execute *.exe, *.bat, *.cmd, and *.msi files either before or after you've installed your update.
How to execute a file
Simply drag the executable file into wyBuild and click the "Execute file after updating has finished" checkbox.
The term "elevation level" refers to UAC (User Account Control) on Windows Vista, Windows 7, Windows 8, and above. An "elevated" process is one that is equivalent to an unrestricted admin.
By default wyUpdate starts all exectuables as the same elevation as wyUpdate. That is, if wyUpdate is running as "elevated", then executables with the elevation type of "Same as wyUpdate" will be started as elevated. You can set the elevation level to any of the following values:
- Same as wyUpdate: Start the executable the same elevation level as wyUpdate.
- Elevated: Start as an elevated process.
- Not elevated: Start as a non-elevated process (the same elevation level as the Windows Shell).
Executing files before your update
When you add files to the temporary folder in wyBuild you will have the ability to execute files either before the update has started and/or after the update has completed:
This gives you the ability to run custom scripts and executables, and then wyUpdate removes the files after the update has completed.
Rolling back update on non-zero return codes
If you have "Wait for execution to finish before continuing" and the file you're executing returns a non-zero exit code, then wyUpdate will rollback the update. If you don't want this, simply uncheck the "Rollback update on non-zero return codes" checkbox. You can also specify a comma separated list of return codes that won't cause the update to rollback.
%basedir% variable can be used as a commandline argument to the program you're executing. This allows you reference the correct location of your program's folder without hardcoding the location.
If you take a look at the screenshot above, you'll see the following commandline argument being passed to the *.bat file:
wyUpdate will automatically replace %basedir% with the location of the your program folder (e.g. C:\Program Files\Your Program\). Note: the
%basedir% variable has the trailing backslash.
%versionto% and %versionfrom% variables
You can also use the
%versionfrom% variables commandline arguments to the program you're executing. This allows you to make version-specific updates to your app.
%wu-temp% variable allows you to reference the temporary directory used by wyUpdate during the update process. It's where the files you put in the "Temporary folder" in wyBuild are sitting. Note: the
%wu-temp% variable has the trailing backslash.
Order of execution
By default wyUpdate executes files in the order they are listed in wyBuild. If you want to change the execution order then simply rename the file inside wyBuild:
Updating databases (Microsoft SQL Server, MySQL, etc.)
You can use this "executing files" functionality to update your databases:
- Create your *.sql file that contains the SQL statements you'll be using to update the databases.
- Create a *.bat file that will call the commandline tool for your database. For example:
- Add the *.sql and *.bat files to the "Temporary folder" in wyBuild.
- Select the *.bat file and click "Execute file", select "After updating has finished", and check "Wait for execution to finish before continuing".