You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过PowerShell提取.dll文件的ProductVersion识别RC预发布版本

PowerShell 提取DLL ProductVersion 实现方案

单文件版本提取

你可以直接用以下命令读取指定dll的ProductVersion字段,返回结果会完整包含RC后缀:
(Get-Item "替换为你的dll文件完整路径").VersionInfo.ProductVersion

批量搜索+版本判断实现

如果需要搜索指定目录下的所有dll,同时自动区分RC预发布版和正式版,可以直接用以下脚本,结果可直接用于后续后处理:

# 配置搜索根路径
$targetDir = "替换为你要搜索的目录路径"

# 执行搜索、提取、判断逻辑,结果存入$dllVersionList变量可直接后续调用
$dllVersionList = Get-ChildItem -Path $targetDir -Filter "*.dll" -Recurse -File | ForEach-Object {
    $currentVer = $_.VersionInfo.ProductVersion
    [PSCustomObject]@{
        文件全路径 = $_.FullName
        ProductVersion = $currentVer
        版本分类 = if ($currentVer.Contains("-RC")) { "RC预发布版" } else { "正式版" }
    }
}

# 执行后直接输出$dllVersionList即可查看所有结果

注意事项

该方法读取的ProductVersion和你在Visual Studio中看到的目标字段完全一致,不会返回纯数字的版本号,完全匹配你的使用需求。

内容的提问来源于stack exchange,提问作者alexis19apl

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 21:15:03