Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # Filename: win_process_list.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- """
- Description:
- This script retrieves a list of running processes on a Windows system using the 'tasklist' command and prints the output.
- Requirements:
- - Python 3.x
- - This script is specifically designed for Windows systems.
- Functions:
- - get_process_list():
- Retrieves a list of running processes on the Windows system and returns the output as a string.
- Usage:
- - Simply execute the script. It will display the list of running processes in the console.
- Additional Notes:
- - This script uses the 'tasklist' command, which is a built-in Windows utility for listing running processes.
- """
- import subprocess
- def get_process_list():
- """
- Retrieves a list of running processes on the Windows system.
- Returns:
- str: A string containing the output of the 'tasklist' command.
- """
- tasklist_output = subprocess.check_output(['tasklist'], shell=True)
- return tasklist_output.decode('utf-8')
- if __name__ == "__main__":
- process_list = get_process_list()
- print(process_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement