Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # Filename: controlpanel_shortcut.py
- # Version: 1.00
- # Author: Jeoi Reqi
- """
- CONTROL PANEL SHORTCUT:
- This script creates a shortcut on the desktop that opens the Control Panel in Windows.
- Requirements:
- - Windows operating system
- - pywin32 library (install via pip install pywin32)
- Usage:
- - Run the script to create a shortcut on the desktop.
- Notes:
- - The shortcut will be named "Control Panel.lnk".
- - The Control Panel will open when the shortcut is double-clicked.
- """
- import os
- import win32com.client
- # Define the CLSID for the Control Panel
- CLSID_ControlPanel = '{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}'
- # Path to the desktop
- desktop_path = os.path.join(os.environ['USERPROFILE'], 'OneDrive', 'Desktop')
- def create_control_panel_shortcut():
- """
- Create a shortcut to the Control Panel on the desktop.
- """
- # Create a shortcut object
- shell = win32com.client.Dispatch('WScript.Shell')
- shortcut = shell.CreateShortcut(os.path.join(desktop_path, 'Control Panel.lnk'))
- # Set the target path using the CLSID
- shortcut.TargetPath = f'::{CLSID_ControlPanel}'
- # Optionally set the icon location to the Control Panel's icon
- shortcut.IconLocation = '%SystemRoot%\\system32\\shell32.dll,-137'
- # Save the shortcut
- shortcut.Save()
- if __name__ == "__main__":
- create_control_panel_shortcut()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement