简体   繁体   English

如何使用 Python 控制 Windows 的程序和功能

[英]How to control Windows' Programs and Features using Python

There is Programs and Features in Windows Control Panel. Windows 控制面板中有程序和功能。

I'd like to control it like Uninstall and Change using Python.我想像卸载和更改一样使用 Python 来控制它。

在此处输入图像描述

How should I achieve this?我应该如何实现这一目标?

I couldn't find any meaningful material.我找不到任何有意义的材料。

I can think of 3 ways to do this.我可以想到 3 种方法来做到这一点。

A) Read the uninstall entries yourself from the registry. A)自己从注册表中读取卸载条目。 There are 4 locations, HKCU/HKLM, 32&64-bit.有 4 个位置,HKCU/HKLM,32 位和 64 位。 Software\Microsoft\Windows\CurrentVersion\Uninstall and enumerate the subkeys. Software\Microsoft\Windows\CurrentVersion\Uninstall并枚举子项。

B) Using the shell interfaces. B)使用 shell 接口。 When you have the IShellFolder for the Programs and Features you can get the IContextMenu and execute command.当您拥有程序和功能的IShellFolder时,您可以获得IContextMenu并执行命令。 I don't recommend this because Programs and Features is going away, everything is being moved to the Settings app.我不建议这样做,因为程序和功能正在消失,所有内容都被移至“设置”应用程序。

C) UIAutomation . C) UI自动化 Not recommended for the same reason as B and it can also be fragile.不推荐使用与 B 相同的原因,它也可能很脆弱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM