Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getfilever.py 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. import os
  2. import win32api
  3. ver_strings = (
  4. "Comments",
  5. "InternalName",
  6. "ProductName",
  7. "CompanyName",
  8. "LegalCopyright",
  9. "ProductVersion",
  10. "FileDescription",
  11. "LegalTrademarks",
  12. "PrivateBuild",
  13. "FileVersion",
  14. "OriginalFilename",
  15. "SpecialBuild",
  16. )
  17. fname = os.environ["comspec"]
  18. d = win32api.GetFileVersionInfo(fname, "\\")
  19. ## backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc
  20. for n, v in d.items():
  21. print(n, v)
  22. pairs = win32api.GetFileVersionInfo(fname, "\\VarFileInfo\\Translation")
  23. ## \VarFileInfo\Translation returns list of available (language, codepage) pairs that can be used to retreive string info
  24. ## any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle two are language/codepage pair returned from above
  25. for lang, codepage in pairs:
  26. print("lang: ", lang, "codepage:", codepage)
  27. for ver_string in ver_strings:
  28. str_info = "\\StringFileInfo\\%04X%04X\\%s" % (lang, codepage, ver_string)
  29. ## print str_info
  30. print(ver_string, repr(win32api.GetFileVersionInfo(fname, str_info)))