GetFileChecksum |
Top Previous Next |
The GetFileChecksum Special Function Command allows you to retrieve a checksum of the specified file formatted as a string. Important: Special Function commands can only be used on the right hand side of a Variable Assignment command. Command Syntax
GetFileChecksum,[FullyQualifiedFileName],[HashType]
The comma character after the command is compulsory as are the file name and hash type parameters.
Parameters:
TargetFileName: The fully qualified path and file name of the file from which to retrieve the checksum. HashType: The hash algorithm to be used to generate the checksum. This must be a string representing a valid member of the HastType enumeration, currently one of the following values: MD5, SHA1, SHA256, SHA384, SHA512
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. Important: The target file MUST already exist before the script is run. Example:
Retrieve the checksum of the installed copy of Windows Media Player
Var:MediaPlayerCheckSum=GetFileChecksum,"C:\Program Files (x86)\Windows Media Player\wmplayer.exe",SHA256
See Also: Special Functions GetBuildFileVersion GetFileNameVersion GetMajorFileVersion GetMinorFileVersion GetRevisionFileVersion GetRegistryValue IncrementFileVersion
|