Jump to content

FileGetVersion() returns outdated info - RESOLVED

Recommended Posts


I found a very old AutoIt script for obtaining file version information (Properties > Details items like the version string, product name, copyright, etc.). It didn't work very well, so I rewrote it after I discovered FileGetVersion().

The problem is that FileGetVersion() is returning outdated information that seems to belong to an old version of the file, long after the file has been deleted and recreated. Windows Explorer, on the other hand, shows up-to-date version info in the Properties > Details tab because (I think) it's accessing the cached file metadata and/or the latest version of the file. This looks similar to the Windows behavior in which (e.g.) the modification time for a previous incarnation of a file is still displayed by dir even after the file has been deleted and recreated. The timestamp is updated eventually, but in my case "eventually" is approaching infinity.

Is there a way in AutoIt to force retrieval of the latest file version properties? Failing that, is there some external method (like a command or admin setting) that can force Windows to return the latest version info when requested by a program?

Edited by tremolux66
Problem resolved

When the going gets tough, the tough start coding.

Share this post

Link to post
Share on other sites


10 minutes ago, Jos said:

Did you check whether the file also exists in: %localappdata%\VirtualStore ?


No; not sure I understand the significance of that.

On the machine I'm developing & testing on, there are only a few folders and files in the %localappdata%\VirtualStore directory tree, and their modification times are a year or more ago. They're mostly from C:\Program Files and C:\Program Files (x86); nothing to do with the directories I'm working in (with my script's .exe and the files it's looking at).

When the going gets tough, the tough start coding.

Share this post

Link to post
Share on other sites

The reason for the question was whether it is finding a different version of the file in the virtual store. That is the only reason I can think of why this could happen.

Another one is when checking files in certain directories like c:\windows\system32  in x64 or x86 mode can return different results.



Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

Share this post

Link to post
Share on other sites

Ah. Nope, my files aren't there.

Windows Explorer (Win 7 Enterprise) can locate old versions of the files I'm testing with and says the location is "Restore point". When I look at the Details tab on the previous version of the file, it's yet another version from what my FileGetVersion() script is reporting, e.g.,

  • Explorer reports file version = 2016.1.20.1 (correct)
  • My script reports file version = 2016.1.8.3
  • Explorer reports previous version's file version = 2016.1.8.4

The files I'm dumping the version info for are mostly AutoIt script .exe files; I use /fileversion Year.Month.Day.Iteration# when building my production code. (I also use /productname, /productversion, /legalcopyright, etc.) The build script deletes all the .exe files from the target directory before running Aut2Exe.

Edited by tremolux66
Reformat some of the text for readability (font).

When the going gets tough, the tough start coding.

Share this post

Link to post
Share on other sites
5 hours ago, MilesAhead said:

I am not sure what is happening.  But ShadowExplorer may show you how many old copies you have to give some clue.  It is freeware.


Thanks - I'll give that a look.

When the going gets tough, the tough start coding.

Share this post

Link to post
Share on other sites

RESOLUTION: I got a new computer. It looks like the OS on my old computer must have been corrupted (somehow). I was seeing a lot of strange behavior w.r.t. an external CD/DVD/BD writer like: 4 drive letters instead of 1, write failures, a drive letter disappeared, regedit crashed when I was investigating the drive-letter issue (trying to back up the Registry), incredibly long load times for optical media, etc. Plus the weird problem described here with out-of-date file information returned by FileGetVersion().

I was issued a new computer, with a fresh OS image, and when I plugged in the optical writer it worked perfectly: 1 drive letter, no write errors, fast load times. It eventually occurred to me to retest my file info utility, and it worked perfectly (so far).

Go figure.

When the going gets tough, the tough start coding.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • ripdad
      By ripdad
      Here is  another WMIC script that parses properties from various alias classes.
      Download:  WMIC_GET.au3
    • ur
      By ur
      How to get the thrid number of a file version.
      Example: Let's say I have a file with below properties.
      I want only the third number like here it is 1941 as highlighted.
      Is there any built in function to get it??

    • ur
      By ur
      I have a custom configuration file which has key-value pairs as in below format.
      BuildLocation:C:\Build BuildExe:setup.exe Release:r9.64.02 Silent:No InstallPath:default Compare :No MartUpgrade :Yes Bit:64 ERwinUpgrade:No I need to change the value of "BuildExe" using my program.
      Is there any inbuilt function already available for these kind of files?.
      Can any one help me how to do this.
    • cyberbit
      By cyberbit

      Super Update!
      Now supports full console actions and running commands from a text file! Run fropmod ? for options.
      Using the GUI:
      Drag and drop a file to the dropbox at the top.
      To set a date/time pair to the current date and time, right mouse click the control and hit Set to Now.
      Hold Shift to use alternate options.
      Hash is a slightly trimmed MD5 of the entire file, so large files will take a bit to compute.
      Using the CmdLine:
      FropMod uses a linear-style command line interface. Commands are linked together to perform tasks. Files are loaded using
      fropmod f <filename> or, to be compatible with native Windows functionality,
      fropmod <filename>.   * Note that this mode will only function if the only parameter is the filename. Avoid using wildcards in the filename, as they will not always act as excepted. If the working directory is changed, FropMod will correctly handle relative paths.
      Every command after f applies to the file passed to f. There is no save command, so each operation is applied immediately.
      If ? is used, the GUI is automatically suppressed and further actions are ignored. ? is not valid except as the first parameter.
      nogui may be used at any place in the command string, except within parameters of other commands. It will suppress the creation of the GUI, and cause FropMod to exit immediately after all commands are parsed.
      Attributes (a) use the following format: +-RASHOT (Read-Only, Archive, System, Hidden, Offline, Temporary). The attributes N, D, and C (Normal, Directory, Compressed) are documented, but read-only. The Offline attribute is not compatible with files on removable drives. Additionally, Normal only appears when all other attributes are removed.
      Dates (d[m|c|a]) use the following format: YYYYMMDDHHmmss. Use the 24hr clock. I think these are broken right now (?) but if they work for you, great. 
      Opening the file as an archive (z) extracts dependencies into a temporary folder, then opens the file through it.
      Only 63 parameters can be passed through the command line (including both commands and their values) due to AutoIt limitations, but larger strings can be used in an .fm1 script, and be run fully.
      FropMod Scripts (.fm1) are run using the e command. Technically they can be of any extension, but I may add action verbs to these files to run on double click in the future.
      Format of an .fm1 script:
      [FMScript] ;comment command [parameter] ;comment command [parameter] ;comment ;comment ... In an .fm1 script, there is no limit to the number of commands that will be parsed. Limit one command per line, as the parser will break if they are stacked. Comments can be by themselves or in-line with commands, using a semicolon. All white space is trimmed off the end of a command, as well.
      Scripts may be called from other scripts. Used properly, this allows for complex building of batch processing. HOWEVER, DO NOT COMMIT A MAJOR PROGRAMMING SIN AND CALL A SCRIPT IN ITSELF! This will kick off an infinite recursion that will quickly drag your system down to a speed at which an Apple 2 could compete. Moral of the story: be careful. 
      The sources use the WinAPIEx and Resources UDFs.
      Here's the updated source and dependencies: fropmodsrc0.2.zip
      Modifies timestamps and attributes of files and directory trees. Can be used to fix EPOCHed files in some cases. Supports Drag & Drop. Supports console actions and text file scripts. Included in the archive is the source, examples and compiled x86/x64 EXEs with icon.

      Previous versions:



    • corgano
      By corgano
      My queestion, is what is the best way to synchronize autoit scripts running on different computers in a network? to the effect that I could sync them, and then beep() and they would both beep at the exact same time
      I'm not sure even where to start. Has anyone done anything like this before?

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.