Paste: deps.ps1
Author: | erg (chatgpt) |
Mode: | powershell |
Date: | Sat, 1 Jun 2024 19:12:01 |
Plain Text |
$exePath = "c:\cygwin64\home\dougc\factor\factor.com"
function Get-DLLVersion {
param (
[string]$dllPath
)
$versionInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllPath)
return $versionInfo.FileVersion
}
$dependencies = & "c:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\bin\HostX64\x64\dumpbin.exe" /DEPENDENTS $exePath | Select-String '\.dll' | ForEach-Object {
$_.Line.Trim()
}
function Find-DLLPath {
param (
[string]$dllName
)
$systemPaths = $env:PATH -split ';'
$exeDirectory = Split-Path -Parent $exePath
$pathsToCheck = $systemPaths + $exeDirectory
foreach ($path in $pathsToCheck) {
$fullPath = Join-Path -Path $path -ChildPath $dllName
if (Test-Path $fullPath) {
return $fullPath
}
}
return $null
}
$dependencyVersions = @()
foreach ($dependency in $dependencies) {
$dllPath = Find-DLLPath -dllName $dependency
if ($dllPath) {
$version = Get-DLLVersion -dllPath $dllPath
$dependencyVersions += [PSCustomObject]@{
DLL = $dependency
Path = $dllPath
Version = $version
}
} else {
$dependencyVersions += [PSCustomObject]@{
DLL = $dependency
Path = "Not found"
Version = "Not found"
}
}
}
$dependencyVersions | Format-Table -AutoSize
New Annotation