[英]Powershell: Export List of apps
I wanted a hands off approach to get a list of all the applications installed on a system.我想要一种不干涉的方法来获取系统上安装的所有应用程序的列表。 A search brought me to many websites that utilized
Get-ItemProperty
like on this page here搜索使我访问了许多使用
Get-ItemProperty
网站,例如本页上的此处
I quickly found that I could export the list to txt file for easy access at a later time.我很快发现我可以将列表导出到 txt 文件,以便以后轻松访问。
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > C:\Users\username\Documents\InstalledPrograms-PS.txt
*username is a place holder *用户名是一个占位符
What I found, however, is that I could run this when pasting it directly into powershell, but when placing this into a script, it would crash or not run at all.然而,我发现我可以在将它直接粘贴到 powershell 时运行它,但是当将它放入脚本时,它会崩溃或根本不运行。
I'm assuming I'm missing something and a straight copy and paste will not work.我假设我遗漏了一些东西,直接复制和粘贴是行不通的。
Any help would be appreciated.任何帮助,将不胜感激。
NOTE: I'm sure someone is bound to recommend WMIC
, but this does not seem to list all the apps.注意:我确定肯定有人会推荐
WMIC
,但这似乎并未列出所有应用程序。
Update: Seems that within my script更新:似乎在我的脚本中
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
on its own works just fine.靠它自己的作品就好了。 It's when the formatting happens that it crashes.
当格式化发生时,它会崩溃。
Solution:解决方案:
For anyone looking to get an easy and quick way to get a list of all applications, including microsoft store ones, here's what I did.对于任何希望获得一种简单快捷的方法来获取所有应用程序(包括 Microsoft Store 应用程序)列表的人来说,这就是我所做的。 I just have them export to a .txt file to keep for later.
我只是让它们导出到 .txt 文件以备后用。
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table > c:\applist.txt
Microsoft Store Apps微软商店应用
Get-AppxPackage | Select Name, PackageFullName |Format-Table -AutoSize > c:\microsoftlist.txt
It worked for me, although emacs said the '-' before AutoSize was a foreign character.它对我有用,尽管 emacs 在 AutoSize 之前说“-”是外来字符。 \\226 It may be unicode en dash, 8211 decimal: https://www.fileformat.info/info/unicode/char/2013/index.htm A regular dash would be 45.
\\226 它可能是 unicode 破折号,十进制 8211: https : //www.fileformat.info/info/unicode/char/2013/index.htm常规破折号是 45。
[int][char]'–'
8211
By the way, there's also get-package
to list installed applications.顺便说一下,还有
get-package
来列出已安装的应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.