
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
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.
Example
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) print(version)
Output
Running the above code will print the version of the Chrome Application.
89.0.4389.114
Now, try to give the location of another application to retrieve its version number.
- Related Articles
- How to get android application version name?
- How do I get the version and build number of an application using Swift?
- How to get the application name and version information of a browser in JavaScript?
- How can I get the current Android SDK version programmatically using Kotlin?
- How to get the IIS Application Pool names using PowerShell?
- How to get programmatically android version number?
- First Bad Version in Python
- Compare Version Numbers in Python
- How to get the IIS Application Pool queue length using PowerShell?
- How to get the IIS Application Pool failure Settings using PowerShell?
- How to get the IIS Application Pool Recycle settings using PowerShell?
- How to get programmatically android Radio version information?
- Get a list of MySQL databases and version?
- Java Program to get Operating System name and version
- How to get default device sdk version in android?
