Command Reference

Read File Information

Reads information about a file on the user's system and stores that information in a variable.

Action ID: 29
Action Category: File Information

Settings

File information to collect

What information do you want to find out about the file? Choose from:

Version

-

The version of the file. This will only work with files that have embedded resourse information, such as EXE or DLL files.

CRC Value

-

The CRC value of the file.

Size

-

The size of the file in bytes.

Existence

-

Whether or not the file exists. Sets the variable to "TRUE" if the file exists, and sets the variable to the Default value if it doesn't.

Short file name

-

The short filename (i.e. the "8.3 filename" or "DOS filename") of the file.

Variable name

The name of the variable to assign the result to.

Default value

The default value to assign to the variable if the file information cannot be determined or if the file does not exist.

File name

The name of the file to investigate.

Return Values

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 

 

1

Could not read file information.

Could not read file version.
<<File name>>

2

Could not read file information.

Could not calculate file CRC.
<<File name>>

3

Could not read file information.

Could not determine file size.
<<File name>>

Examples

Example 1

In this example, we will find out what version of Notepad the user has on their system.

File information to collect - Version
Variable name - %NotepadVersion%
Default value - 0.0.0.0
File name - %WinDir%\Notepad.exe

Example 2

In this example, we will read in the CRC of our main executable "MyProgram.exe" from our main application directory. We will store this information in a custom variable named %MyProgramCRC%.

By reading in the CRC value, we could compare it to a list of valid CRC values. This would be useful if we wanted to make sure the user did not have a "stolen" copy of our software.

File information to collect: CRC Value
Variable name: %MyProgramCRC%
Default value: 0
File name: %AppDir%\MyProgram.exe

 

See Also: Alphabetical List of Actions, Categorical List of Actions, On Error tab