[英]How to uninstall an application using python?
I'm using Spyder as an IDE on Windows 10 and I've been searching for python programs that will uninstall particular applications upon execution.我在 Windows 10 上使用 Spyder 作为 IDE 并且我一直在搜索 python 程序,这些程序将在执行时卸载特定的应用程序。 So far, I have found a couple of sources:
到目前为止,我已经找到了几个来源:
for app in winapps.search_installed('[app_name]'):
print(app)
winapps.uninstall('[app_name]', args=['/S'])
Are there any other modules and/or methods I can use to uninstall applications on my system?是否有任何其他模块和/或方法可以用来卸载系统上的应用程序?
If you can call PowerShell commands with Administratos rights, maybe could you use this method:如果您可以使用管理员权限调用 PowerShell 命令,也许您可以使用此方法:
List the installed applications:列出已安装的应用程序:
Get-WmiObject -Class Win32_Product | Select-Object -Property Name
Create a variable with informations about the app that you want to uninstall:创建一个包含您要卸载的应用程序信息的变量:
$MyApp = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Java Auto Updater"}
And after, just call the Uinstall Method:之后,只需调用 Uinstall 方法:
$MyApp.Uninstall()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.