如何使用 Flutter 在 Windows 上获取已安装应用程序的版本号?

问题描述 投票:0回答:0

我想通过 Flutter 获取安装在 Windows 上的应用程序的版本号。我尝试使用 shell 命令使用 regedit 或 wmic 等工具来做到这一点。

从现在开始谢谢你。

例子: 使用包“process_run:^0.12.5+2”; var shell = Shell(); final result = await shell.run( 'reg query HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall /s');

当我使用命令时,我可以搜索所有应用程序,并得到这样的结果列表

AuthorizedCDFPrefix    REG_SZ    
Comments    REG_SZ    
Contact    REG_SZ    
DisplayVersion    REG_SZ    14.32.31332
HelpLink    REG_SZ    
HelpTelephone    REG_SZ    
InstallDate    REG_SZ    20221224
InstallLocation    REG_SZ    
InstallSource    REG_SZ    C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualCpp.RuntimeDebug.14,version=14.32.31332,chip=x86\
ModifyPath    REG_EXPAND_SZ    MsiExec.exe /I{F98134CC-02C9-4B94-B2B0-5D6B2F5F2F76}
Publisher    REG_SZ    Microsoft Corporation
Readme    REG_SZ    
Size    REG_SZ    
EstimatedSize    REG_DWORD    0x61b2
SystemComponent    REG_DWORD    0x1
UninstallString    REG_EXPAND_SZ    MsiExec.exe /I{F98134CC-02C9-4B94-B2B0-5D6B2F5F2F76}
URLInfoAbout    REG_SZ    
URLUpdateInfo    REG_SZ    
VersionMajor    REG_DWORD    0xe
VersionMinor    REG_DWORD    0x20
WindowsInstaller    REG_DWORD    0x1
Version    REG_DWORD    0xe207a64
Language    REG_DWORD    0x409
DisplayName    REG_SZ    Microsoft Visual C++ 2022 X86 Debug Runtime - 14.32.31332

但我想通过给出特定应用程序的路径来了解该应用程序的版本号

我想要的功能是这样的:

Future<String?> getApplicationVersion(String installLocation) async {}

实际上有一个包完全符合我的要求,但它只适用于 android 我需要这个包的 windows 替代品(device_apps:^2.2.0)

windows flutter shell dart
© www.soinside.com 2019 - 2024. All rights reserved.