Get Application Version using Python

In software industries, whenever developers add a new feature, fix bugs in a particular application, they name the application to a new version, as it helps to recognize the recently updated features in that application.

Using Python, we can get the version of any application. We will use pywin32 to interact with the executable files. It provides access to the win32 API which gives the ability to create COM and objects.

  • First, install the required package by typing pip install pywin32 in the command shell.

  • Import Dispatch to get the version number of the application.

  • Create a variable to store the location of the application.

  • Define a function for getting the version that takes the location of the executable file and parses using the Dispatch method.

  • Return the version number using GetFileVersion(app_location) method.


In this example, we try to get the version of Chrome Application in our System,
#Import the required Module
from win32com.client import Dispatch
def get_version_number(app_location):
   parser = Dispatch("Scripting.FileSystemObject")
   version = parser.GetFileVersion(app_location)
   return version
app_location = r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
version = get_version_number(app_location)


Running the above code will print the version of the Chrome Application.


Now, try to give the location of another application to retrieve its version number.