Advertisement
Python253

easeofaccess_shortcut

Mar 21st, 2024
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.31 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # Filename: easeofaccess_shortcut.py
  3. # Version: 1.00
  4. # Author: Jeoi Reqi
  5.  
  6. """
  7. EASE OF ACCESS SHORTCUT:
  8.  
  9. This script creates a shortcut on the desktop that opens the Ease of Access Center in Windows.
  10.  
  11. Requirements:
  12. - Windows operating system
  13.  
  14. Usage:
  15. - Run the script to create a shortcut on the desktop that opens the Ease of Access Center.
  16.  
  17. Notes:
  18. - The shortcut will be named "Ease_of_Access_Center.lnk".
  19. - The Ease of Access Center will open when the shortcut is double-clicked.
  20. """
  21.  
  22. import os
  23. import subprocess
  24.  
  25. def create_ease_of_access_center_shortcut():
  26.     """
  27.    Create a shortcut to the Ease of Access Center on the desktop.
  28.    """
  29.     # Get the path to the desktop
  30.     desktop_path = os.path.join(os.environ['USERPROFILE'], 'OneDrive', 'Desktop')
  31.  
  32.     # Create a shortcut on the desktop using PowerShell
  33.     powershell_command = fr'''
  34.    $WshShell = New-Object -ComObject WScript.Shell
  35.    $Shortcut = $WshShell.CreateShortcut("{desktop_path}\Ease_of_Access_Center.lnk")
  36.    $Shortcut.TargetPath = "control.exe"
  37.    $Shortcut.Arguments = "/name Microsoft.EaseOfAccessCenter"
  38.    $Shortcut.Save()
  39.    '''
  40.     subprocess.run(['powershell', '-Command', powershell_command], capture_output=True)
  41.  
  42. if __name__ == "__main__":
  43.     create_ease_of_access_center_shortcut()
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement