IncrementFileNameVersion

Top  Previous  Next

 

The IncrementFileNameVersion Special Function Command allows you to retrieve the version number of the specified file formatted as a string whilst at the same time incrementing any one part of the version with the decimal points replaced with underscores for use in creating file names that include a version number.

lamp Important: Special Function commands can only be used on the right hand side of a Variable Assignment command.

Command Syntax

 

IncrementFileNameVersion,[FullyQualifiedFileName],[VersionPart]

 

The comma character after the command is compulsory as is the file name parameter.

 

Parameters:

 

TargetFileName: The fully qualified path and file name of the file from which to retrieve the version information.

VersionPart: The part of the version number to be incremented. This must be a string representing a valid member of the VersionPart enumeration, currently one of the following values: Major, Minor, Build, Revision

 

Both parameters are compulsory. If any required parameter is missing or invalid an error will be thrown. The TargetFileName parameter must be surrounded by quotation marks if one or more spaces are included in the path and file name. It is good practice to include the quotation marks in any case, so that it reduces the risk of error when writing scripts.

 

Example:

 

Retrieve the version number of the installed version of Windows Media Player, and increment the Revision number before returning the version number as a formatted string

 

Var:Version=IncrementFileNameVersion,"C:\Program Files (x86)\Windows Media Player\wmplayer.exe,Revision"

 

See Also: Special Functions GetBuildFileVersion GetFileNameVersion GetMajorFileVersion GetMinorFileVersion GetRevisionFileVersion GetRegistryValue