获取商店里的应用的中文和英文名称

devtools/2024/11/24 16:00:54/

一、照例先来个大鼻窦

# 首次使用 PowerShell 5.1 (ISE) 先执行 RemoteSigned,再执行ps1脚本 !!!
# Set-ExecutionPolicy RemoteSignedSet-ExecutionPolicy Unrestricted -Scope CurrentUser
# PowerShell 7 不是系统预装版本,先开启 远程执行 权限。防止启动闪退。
if ($PSVersionTable.PSVersion.Major -eq 7) { Set-ExecutionPolicy RemoteSigned }Clear# -----------------------------------------------------------------------------------------------------------# 获取开始菜单上的APP显示名称等
Function GetStartMenuAppNames {Get-StartApps | Sort-Object Name | Out-Default# Get-StartApps | Out-GridViewRead-Host '按任意键继续'return
}
GetStartMenuAppNames# -----------------------------------------------------------------------------------------------------------# 获取商店应用包显示名称
Function GetStoreAppPackageNames {$manifest = Get-AppxPackage 'Microsoft.WindowsStore' | Get-AppxPackageManifest$displayName = $manifest.Package.Properties.DisplayName
}# -----------------------------------------------------------------------------------------------------------Function FindAppPackage {$manifest = Get-AppxPackage | Where-Object { $_.Name -Like "%Thunderbolt%" }$manifest = Get-AppxPackage | Where-Object { $_.Name -eq "AppUp.ThunderboltControlCenter" }$manifest | Format-Custom * -Depth 5
}# -----------------------------------------------------------------------------------------------------------# 获取所有已安装的应用包显示名称
Function GetApppPackageNames {$appxPackages = Get-AppxPackageforeach ($package in $appxPackages) {# 获取每个应用的包声明$manifest = Get-AppxPackageManifest -Package $package.PackageFullName# 尝试获取显示名称和发布者名称$displayName = $manifest.Package.Applications.VisualElements.DisplayName$publisherName = $manifest.Package.Applications.VisualElements.PublisherDisplayName# 输出信息Write-Host "Package Name: $($package.Name)"Write-Host "Display Name: $displayName"Write-Host "Publisher Name: $publisherName"Write-Host "-------------------------------------"}
}# -----------------------------------------------------------------------------------------------------------<#注册表位置:
如 "便笺":[HKEY_CURRENT_USER\Software\Classes\Local Settings\MrtCache\C:%5CProgram Files%5CWindowsApps%5CMicrosoft.MicrosoftStickyNotes_4.0.6104.0_x64__8wekyb3d8bbwe%5Cmicrosoft.system.package.metadata%5CS-1-5-21-2998897788-1970802310-3550713626-1001-MergedResources-2.pri\1db2af2499769d1\2e09107b]
"@{Microsoft.MicrosoftStickyNotes_4.0.6104.0_x64__8wekyb3d8bbwe?ms-resource://Microsoft.MicrosoftStickyNotes/Resources/StickyNotesStoreAppName}"="Microsoft 便笺"
"@{Microsoft.MicrosoftStickyNotes_4.0.6104.0_x64__8wekyb3d8bbwe?ms-resource://Microsoft.MicrosoftStickyNotes/Resources/StickyNotesAppName}"="便笺"
"@{Microsoft.MicrosoftStickyNotes_4.0.6104.0_x64__8wekyb3d8bbwe?ms-resource://Microsoft.MicrosoftStickyNotes/Files/Assets/Icons/StickyNotesAppList.png}"="C:\\Program Files\\WindowsApps\\Microsoft.MicrosoftStickyNotes_4.0.6104.0_neutral_split.scale-400_8wekyb3d8bbwe\\Assets\\Icons\\StickyNotesAppList.scale-400.png"# -----------------------------------------------------------------------------------------------------------# https://www.cnblogs.com/hupo376787/p/8227911.html#UWP 应用程序名称本地化以及商店显示名称本地化
# 本地化即显示中文名称https://bbs.pcbeta.com/viewthread-1987852-1-1.html#MakePri.exe&resources.pri,查应用中文名称
https://learn.microsoft.com/zh-cn/windows/uwp/app-resources/compile-resources-manually-with-makepri#使用 MakePri.exe 手动编译资源 
https://bbs.pcbeta.com/viewthread-1987852-1-1.html查看 Microsoft.Windows.ContentDeliveryManager 的中文名称 "Microsoft 内容"MakePri.exe dump /if "C:\Windows\SystemApps\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\pris\resources.zh-CN.pri" /of C:\ContentDeliveryManager_AppxManifest.xmlContentDeliveryManager_AppxManifest.xml 内容:<NamedResource name="AppDisplayName" uri="ms-resource://Microsoft.Windows.ContentDeliveryManager/resources/AppDisplayName"><Candidate qualifiers="Language-ZH-CN" type="String"><Value>Microsoft 内容</Value></Candidate>
</NamedResource>查看 Movies/Films 的中文名称 "电影和电视"MakePri.exe dump /if "C:\Program Files\WindowsApps\Microsoft.ZuneVideo_10.24081.10111.0_x64__8wekyb3d8bbwe\microsoft.system.package.metadata\resources.69d5867e.pri" /of "C:\ZunVideo_AppxManifest.xml"注意: microsoft.system.package.metadata 是系统隐藏目录。ZunVideo_AppxManifest.xml 内容:<PriInfo><ResourceMap name="Microsoft.ZuneVideo" ><ResourceMapSubtree name="resources"><NamedResource name="IDS_MANIFEST_VIDEO_APP_NAME" uri="ms-resource://Microsoft.ZuneVideo/resources/IDS_MANIFEST_VIDEO_APP_NAME"><Candidate qualifiers="Language-EN-US" isDefault="true" type="String"><Value>Movies &amp; TV</Value></Candidate><Candidate qualifiers="Language-EN-GB" isDefault="true" type="String"><Value>Films &amp; TV</Value></Candidate><Candidate qualifiers="Language-ZH-CN" type="String"><Value>电影和电视</Value></Candidate></NamedResource></ResourceMapSubtree></ResourceMap>
</PriInfo>#># -----------------------------------------------------------------------------------------------------------<#
* 下面我将写两个程序,通过众多 APP 目录里的 PRI 文件, 解析出如上的 XML, 再通过 XML, 来获取 Windows 上预安装(+卸载残留)的 APP 的中文名称。GetNamedResources_fuzzy    模糊搜索,获取商店应用包显示名称,包含在商店里显示和打开应用时显示的英文和中文,还有一些多余的对照名称。
GetNamedResources_accurate 精确搜索,获取商店应用包显示名称,只包含应用窗口标题显示的英文和中文
#><## Code:# https://learn.microsoft.com/zh-cn/windows/win32/appxpkg/how-to-develop-oem-app-with-custom-file#microsoft.system.package.metadata
# 查看 Microsoft.Windows.ContentDeliveryManager 的中文名称 "Microsoft 内容"#>Function ListAppNames {# 【第一步】# 定义 PRI 文件路径$pri_parttern = "C:\Program Files\WindowsApps\*\microsoft.system.package.metadata\resources*.pri"# $pri_parttern = "D:\Users\test\Desktop\1\resources*.pri"# 定义执行程序路径$make_pri_exe = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\makepri.exe"# 获取所有匹配的 PRI 文件$pri_files = Get-ChildItem -Path $pri_parttern# 定义要创建的目录路径$directoryPath = Join-Path -Path $env:TEMP -ChildPath "WindowsApps_AppxManifest"if (Test-Path -Path $directoryPath) {Remove-Item -Path $directoryPath -Recurse}# 检查目录是否存在,如果不存在则创建它if (-not (Test-Path -Path $directoryPath)) {New-Item -Path $directoryPath -ItemType Directory}$file_no = 0# 遍历每个 PRI 文件并执行 MakePri.exe dump 命令foreach ($file in $pri_files) {$file_no += 1# 定义输出 XML 文件的路径$output_file = Join-Path -Path $directoryPath -ChildPath ($file.BaseName + ".xml")# 调用 MakePri.exe 进行转换& $make_pri_exe dump /if "$($file.FullName)" /of "$output_file"}Write-Output "原文件数: $file_no"# 【第二步】# 定义 XML 文件路径$xmlFiles = Get-ChildItem -Path "$env:TEMP\WindowsApps_AppxManifest\*.xml"# 创建一个空的数组来存储结果$result = @()$uniqueResults = $result$file_no = 0# 遍历每个 XML 文件foreach ($file in $xmlFiles) {try {$file_no += 1$xmlContent         = $null$resourceMapName    = $null$resourceMapSubtree = $null$namedResources     = $null$namedResources2    = $null$candidates         = $null$candidate          = $null# 解析 XML 文件,使用 -Raw 和 -Encoding UTF8 参数读取文件内容$xmlContent = [xml](Get-Content -Path $file.FullName -Raw -Encoding UTF8)if (-not $xmlContent) { throw "无法解析 XML 文件。" }if (-not $xmlContent.PriInfo.ResourceMap.ResourceMapSubtree) { throw "未找到 PriInfo.ResourceMap.ResourceMapSubtree 节点。"}# 提取 ResourceMap name$resourceMapName = $xmlContent.PriInfo.ResourceMap.name# 提取 resourceMapSubtree 段落$resourceMapSubtree = $xmlContent.PriInfo.ResourceMap.ResourceMapSubtree | Where-Object { ($_.name -like '*resources') -or ($_.name -eq "hxcommintl")## for "C:\Program Files\WindowsApps\microsoft.windowscommunicationsapps_16005.14326.22084.0_x64__8wekyb3d8bbwe\microsoft.system.package.metadata\resources.eac0017e.pri"}if (-not $resourceMapSubtree) {$resourceMapSubtree = $xmlContent.PriInfo.ResourceMap.ResourceMapSubtree | Where-Object { ($_.name -eq "lenssdk")}if ($resourceMapSubtree) {$resourceMapSubtree = $resourceMapSubtree.ResourceMapSubtree | where-Object {($_.name -eq "resources")}}## for "C:\Program Files\WindowsApps\Microsoft.WindowsCamera_2024.2408.1.0_x64__8wekyb3d8bbwe\microsoft.system.package.metadata\resources.4a7c33df.pri"}# 检查是否找到资源子树$namedResources = $nullif ($resourceMapSubtree) {# 确保 NamedResource 存在$namedResources = GetNamedResources_fuzzy -resourceMapSubtree $resourceMapSubtree} else {throw "未找到 ResourceMap name=`"$resourceMapName`" 的子节点 ResourceMapSubtree name=`"resources`""}if ($resourceMapSubtree.ResourceMapSubtree) {$resourceMapSubtree = $resourceMapSubtree.ResourceMapSubtree | Where-Object { ($_.name -eq "appname") -or ($_.name -eq "store") -or ($_.name -eq "clipchamp")}if ($resourceMapSubtree) {$namedResources2 = GetNamedResources_fuzzy -resourceMapSubtree $resourceMapSubtree}if ($namedResources2) {$namedResourcesTmp = @()$namedResourcesTmp += $namedResources$namedResourcesTmp += $namedResources2$namedResources = $namedResourcesTmp}## for "C:\Program Files\WindowsApps\Microsoft.MicrosoftOfficeHub_18.2410.1081.0_x64__8wekyb3d8bbwe\microsoft.system.package.metadata\resources.40721420.pri"## for "C:\Program Files\WindowsApps\Clipchamp.Clipchamp_3.1.11820.0_neutral__yxz26nhyzhsrt\microsoft.system.package.metadata\resources.ce92e9bf.pri"}if ($namedResources) {foreach ($namedResource in $namedResources) {# 提取 Candidate$candidates = $namedResource.Candidateif ($candidates) {$englishName = ""$chineseName = ""foreach ($candidate in $candidates) {# 检查候选者的语言if ($candidate.qualifiers -like 'Language-EN*') {$englishName = $candidate.Value}elseif ($candidate.qualifiers -eq "Language-ZH-CN" -or $candidate.qualifiers -like 'Language-ZH-HANS*') {$chineseName = $candidate.Value}}# 将提取的信息添加到结果数组$result += [PSCustomObject]@{FileNO          = $file_no.ToString().PadLeft(4)PriFileName     = $file.BaseName + ".pri"ResourceMapName = $resourceMapNamenamedResource   = $namedResource.nameEnglishName     = $englishNameChineseName     = $chineseName}}}} else {throw "未找到匹配的 NamedResource 节点。"}} catch {Write-Host "出错文件: $($file.FullName)"Write-Host "异常信息: $_"Write-Host "异常行号: $($_.InvocationInfo.ScriptLineNumber)`n"}}# $result | Get-Member[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # 去重并保留每个相同项的一个实例# $result = $result | Group-Object ResourceMapName, EnglishName, ChineseName | ForEach-Object {#     $_.Group | Select-Object -First 1# }# 一行长度过长,使用以下方法输出(注意中文字符只占一个英文字符位置):# 方法 2# 修改窗口行长度、高度(行数),对 控制台 有效,但对 ISE 无效。$bufSize = $Host.UI.RawUI.BufferSize$bufSize.Width = 1024; $bufSize.Height = 9999;# 调整缓冲区大小$Host.UI.RawUI.Set_BufferSize($bufSize)if ($psISE) {Write-Output "此脚本不能在 PowerShell ISE 中调整窗口大小。"} else {# 调整窗口大小$winSize = $Host.UI.RawUI.WindowSize$winSize.Width = 500$winSize.Height = 30}# 方法 3# 超出长度时,折行输出$uniqueResults = $result  | Sort-Object -Property ResourceMapName, PriFileName, EnglishName | Format-Table -AutoSize -Wrap$uniqueResults# 定义输出文件路径$outputFilePath = Join-Path -Path $env:TEMP -ChildPath "AppResourcesTable.txt"# 将结果输出到文件# $result | Format-Table -AutoSize | Out-String -Width 4096 | Out-File -FilePath $outputFilePath -Encoding UTF8BOM$uniqueResults | Out-String -Width 4096 | Out-File -FilePath $outputFilePath -Encoding UTF8BOMWrite-Output "共处理文件数: $file_no"# 输出结果文件路径Write-Output "结果已保存到: $outputFilePath"
}Function GetNamedResources_fuzzy($resourceMapSubtree=$null) {$namedResources = $nullif ($resourceMapSubtree.NamedResource){$namedResources = $resourceMapSubtree.NamedResource | Where-Object {($_.name -eq "AppName") -or ($_.name -like '*APP_NAME') -or ($_.name -like 'APP_*_NAME') -or ($_.name -eq "app_name_ms_todo") -or ($_.name -eq "app_name_todo") -or ($_.name -eq "AppStoreName") -or ($_.name -eq "AppListName") -or ($_.name -eq "StickyNotesAppName") -or($_.name -like 'StoreAppName*') -or ($_.name -like '*StoreAppName') -or  ($_.name -like 'AppDisplayName*') -or ($_.name -like '*DisplayName') -or ($_.name -eq "Title") -or ($_.name -eq "AppTitle") -or ($_.name -eq "ApplicationTitle") -or ($_.name -eq "SettingsPageTitle") -or ($_.name -eq "Backup_Error_Title") -or ($_.name -eq "System_Item_Title_IntelGraphicsControlPanel") -or # ($_.name -eq "AppDescription") -or ($_.name -eq "Text") -or ($_.name -eq "GameBar")}}return $namedResources}# ListAppNames
# pause
# return# -----------------------------------------------------------------------------------------------------------<#Output:原文件数: 37
出错文件: C:\Users\test\AppData\Local\Temp\WindowsApps_AppxManifest\resources.68259066.xml
异常信息: 未找到 ResourceMap name="Microsoft.XboxGameOverlay" 的子节点 ResourceMapSubtree name="resources"
异常行号: 240此脚本不能在 PowerShell ISE 中调整窗口大小。FileNO PriFileName            ResourceMapName                        namedResource                                     EnglishName                         ChineseName
------ -----------            ---------------                        -------------                                     -----------                         -----------11   resources.3bc408d2.pri AppUp.IntelGraphicsExperience          System_Item_Title_IntelGraphicsControlPanel       Intel® Graphics Command Center      英特尔® 显卡控制中心9   resources.30251b3a.pri B9ECED6F.ASUSPCAssistant               AppName                                           MyASUS                              华硕管家(MyASUS)9   resources.30251b3a.pri B9ECED6F.ASUSPCAssistant               AppDisplayName                                    MyASUS                              华硕管家(MyASUS)32   resources.ce92e9bf.pri Clipchamp.Clipchamp                    AppName                                           Microsoft Clipchamp                 Microsoft Clipchamp36   resources.ed77f9d3.pri Microsoft.BingNews                     AppTitle                                          News                                资讯36   resources.ed77f9d3.pri Microsoft.BingNews                     ApplicationTitle                                  News                                资讯12   resources.3d1a01fd.pri Microsoft.BingWeather                  ApplicationTitle                                  Weather                             天气21   resources.8647cb71.pri Microsoft.DesktopAppInstaller          appDisplayName                                    App Installer                       应用安装程序21   resources.8647cb71.pri Microsoft.DesktopAppInstaller          wingetAppDisplayName                              Windows Package Manager Client      Windows 程序包管理器客户端21   resources.8647cb71.pri Microsoft.DesktopAppInstaller          wingetFileTypeDisplayName                         WinGet configuration file           WinGet 配置文件37   resources.fb239a69.pri Microsoft.GamingApp                    Autosuggest_Product_Type_AddOn_DisplayName        Add-on                              附加内容37   resources.fb239a69.pri Microsoft.GamingApp                    Autosuggest_Product_Type_Game_DisplayName         Game                                游戏37   resources.fb239a69.pri Microsoft.GamingApp                    Autosuggest_Product_Type_Bundle_DisplayName       Game | Bundle                       游戏 | 捆绑包37   resources.fb239a69.pri Microsoft.GamingApp                    Autosuggest_Product_Type_Subscription_DisplayName Subscription                        订阅26   resources.a8811732.pri Microsoft.GamingServices               GamingServicesDisplayName                         Gaming Services                     游戏服务26   resources.a8811732.pri Microsoft.GamingServices               DisplayName                                       Gaming UI                           游戏用户界面26   resources.a8811732.pri Microsoft.GamingServices               ServiceStubDisplayName                            Service Stub                        服务存根27   resources.bdcc8e58.pri Microsoft.Getstarted                   AppStoreName                                      Microsoft Tips                      Microsoft 使用技巧27   resources.bdcc8e58.pri Microsoft.Getstarted                   SettingsPageTitle                                 Settings                            设置27   resources.bdcc8e58.pri Microsoft.Getstarted                   AppName                                           Tips                                提示13   resources.40721420.pri Microsoft.MicrosoftOfficeHub           Title                                             Microsoft 365 (Office)              Microsoft 365 (Office)31   resources.cc9b63b2.pri Microsoft.MicrosoftSolitaireCollection Backup_Error_Title                                Microsoft Solitaire Collection      Microsoft Solitaire Collection2   resources.0de58f7e.pri Microsoft.MicrosoftStickyNotes         StickyNotesStoreAppName                           Microsoft Sticky Notes              Microsoft 便笺2   resources.0de58f7e.pri Microsoft.MicrosoftStickyNotes         StickyNotesAppName                                Sticky Notes                        便笺24   resources.987ed26d.pri Microsoft.Paint                        OleClassShortDisplayName                          Bitmap Image                        BMP 图像24   resources.987ed26d.pri Microsoft.Paint                        AppDisplayName                                    Paint                               画图24   resources.987ed26d.pri Microsoft.Paint                        AppTitle                                          Paint                               画图24   resources.987ed26d.pri Microsoft.Paint                        OleClassDisplayName                               Paintbrush Picture                  画笔图片24   resources.987ed26d.pri Microsoft.Paint                        SettingsPageTitle                                 Settings                            设置24   resources.987ed26d.pri Microsoft.Paint                        Text                                              Text                                文本3   resources.10155da6.pri Microsoft.People                       AppStoreName                                      Microsoft People                    Microsoft 人脉3   resources.10155da6.pri Microsoft.People                       AppListName                                       People                              人脉30   resources.c5087889.pri Microsoft.PowerAutomateDesktop         AppStoreName                                      Power Automate                      Power Automate30   resources.c5087889.pri Microsoft.PowerAutomateDesktop         AppDisplayName                                    Power Automate                      Power Automate33   resources.cf1ff735.pri Microsoft.ScreenSketch                 Text                                              Snipping Tool                       截图工具33   resources.cf1ff735.pri Microsoft.ScreenSketch                 AppStoreName                                      Snipping Tool                       截图工具20   resources.75660818.pri Microsoft.Todos                        app_name_ms_todo                                  Microsoft To Do                     Microsoft To Do20   resources.75660818.pri Microsoft.Todos                        app_name_todo                                     To Do                               To Do1   resources.0b71473d.pri Microsoft.Windows.DevHome              AppDisplayName                                    Dev Home                       

http://www.ppmy.cn/devtools/136582.html

相关文章

redis中的set类型及常用命令

集合就是把一些有关联的数据放到一起。与list不同的是&#xff0c;集合中的顺序不重要&#xff0c;变换了元素的顺序&#xff0c;仍是同一个集合。集合中的元素是不能重复的。和list类似&#xff0c;集合中的每个元素&#xff0c;也都是string类型。 关于集合的相关命令 sadd/…

小程序-基于java+SpringBoot+Vue的农场管理系统设计与实现

项目运行 1.运行环境&#xff1a;最好是java jdk 1.8&#xff0c;我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境&#xff1a;IDEA&#xff0c;Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境&#xff1a;Tomcat 7.x,8.x,9.x版本均可 4.硬件环境&#xff1a…

STM32 RAM在Memory Map中被分为3个区域

型号为STM32F407ZET6&#xff0c;Memory Map如下&#xff1a; 可以看到Flash是完整的一块区域&#xff0c;而RAM却被分成了12KB 16KB 64KB 192KB的三块。 通过查阅资料可知这是ST在芯片设计时针对不同类型的变量做出的考虑&#xff0c;其中&#xff1a; 1.CCM SRAM&#x…

DB2 import/export data

Exporting data to an SQL file for migration can be achieved by generating INSERT statements. However, DB2 doesn’t have a direct EXPORT TO SQL option. Instead, you can combine a query with scripting to generate SQL INSERT statements. Alternatively, DB2’s…

小米顾此失彼:汽车毛利大增,手机却跌至低谷

科技新知 原创作者丨依蔓 编辑丨蕨影 三年磨一剑的小米汽车毛利率大增&#xff0c;手机业务毛利率却出现下滑景象。 11月18日&#xff0c;小米集团发布 2024年第三季度财报&#xff0c;公司实现营收925.1亿元&#xff0c;同比增长30.5%&#xff0c;预估902.8亿元&#xff1b;…

GRU (门控循环单元 - 基于RNN - 简化LSTM又快又好 - 体现注意力的思想) + 代码实现 —— 笔记3.5《动手学深度学习》

目录 0. 前言 1. 门控隐状态 1.1 重置门和更新门 1.2 候选隐状态 1.3 隐状态 2. 从零开始实现 2.1 初始化模型参数 2.2 定义模型 2.3 训练与预测 3 简洁实现 4. 小结 0. 前言 课程全部代码&#xff08;pytorch版&#xff09;已上传到附件看懂上一篇RNN的所有细节&am…

Ansys Zemax | 使用多重结构操作数控制单一结构系统中的参数

附件下载 联系工作人员获取附件 概述 这篇文章向您展示了如何使用多重结构编辑器来优化系统、调整公差以及对那些不能从其它编辑器中获取的数值设置跟随求解。 介绍 当光学系统需要在不同状态或结构下进行建模时&#xff0c;OpticStudio中的多重结构 (Multiple Configurat…

蓝桥杯每日真题 - 第22天

题目&#xff1a;&#xff08;卡片&#xff09; 题目描述&#xff08;12届 C&C B组B题&#xff09; 解题思路&#xff1a; 该问题要求用数字卡片从 1 开始拼出整数&#xff0c;直到某一时刻不能拼出时停止。要确定拼到哪个最大整数&#xff0c;需要统计 每个数字“1”被用…