Improve list-cli-tools.ps1

This commit is contained in:
Markus Fleschutz 2021-07-26 20:09:48 +02:00
parent 23745ca48b
commit 36b626fce7

View File

@ -11,114 +11,124 @@
Author: Markus Fleschutz / License: CC0 Author: Markus Fleschutz / License: CC0
#> #>
function CheckFor { param([string]$Cmd) function CheckFor { param([string]$Cmd, [string]$VersionArg)
try { try {
$Info = Get-Command $Cmd -ErrorAction Stop $Info = Get-Command $Cmd -ErrorAction Stop
$Version = $Info.Version
$Location = $Info.Source $Location = $Info.Source
if ($Version -eq "0.0.0.0") {
$Result = invoke-expression "$Location $VersionArg"
if ($Result -match '\d+\.\d+') {
$Version = "$($Matches[0])"
} else {
$Version = "?"
}
}
if (test-path "$Location" -pathType leaf) { if (test-path "$Location" -pathType leaf) {
$FileSize = (Get-Item "$Location").Length $FileSize = (Get-Item "$Location").Length
} else { } else {
$FileSize = "0" $FileSize = "0"
} }
new-object PSObject -Property @{ Name=$Cmd; Version=$Info.Version; Location=$Location; FileSize=$FileSize } new-object PSObject -Property @{ Name=$Cmd; Version=$Version; Location=$Location; FileSize=$FileSize }
} catch { } catch {
return return
} }
} }
function ListTools { function ListTools {
CheckFor 7z CheckFor 7z "--version"
CheckFor ant CheckFor ant "--version"
CheckFor apt CheckFor apt "--version"
CheckFor apt-get CheckFor apt-get "--version"
CheckFor amixer CheckFor amixer "--version"
CheckFor aplay CheckFor aplay "--version"
CheckFor ar CheckFor ar "--version"
CheckFor arecord CheckFor arecord "--version"
CheckFor at CheckFor at "-V"
CheckFor awk CheckFor awk "--version"
CheckFor basename CheckFor basename "--version"
CheckFor bash CheckFor bash "--version"
CheckFor bc CheckFor bc "--version"
CheckFor cc CheckFor cc "--version"
CheckFor cksum CheckFor cksum "--version"
CheckFor clang CheckFor clang "--version"
CheckFor curl CheckFor curl "--version"
CheckFor cut CheckFor cut "--version"
CheckFor diff CheckFor diff "--version"
CheckFor find CheckFor find "--version"
CheckFor ftp CheckFor ftp "--version"
CheckFor gcc CheckFor gcc "--version"
CheckFor gdb CheckFor gdb "--version"
CheckFor git CheckFor git "--version"
CheckFor gpg CheckFor gpg "--version"
CheckFor help CheckFor help "--version"
CheckFor ipfs CheckFor htop "--version"
CheckFor java CheckFor ipfs "--version"
CheckFor lsb_release CheckFor java "--version"
CheckFor lzma CheckFor lsb_release "--version"
CheckFor make CheckFor lzma "--version"
CheckFor md5sum CheckFor make "--version"
CheckFor mkfifo CheckFor md5sum "--version"
CheckFor nice CheckFor mkfifo "--version"
CheckFor nroff CheckFor nice "--version"
CheckFor nslookup CheckFor nroff "--version"
CheckFor openssl # CheckFor nslookup "--version"
CheckFor perl CheckFor openssl "--version"
CheckFor ping CheckFor perl "--version"
CheckFor ping6 CheckFor ping "--version"
CheckFor printf CheckFor ping6 "--version"
CheckFor python CheckFor printf "--version"
CheckFor regedit CheckFor python "--version"
CheckFor replace CheckFor regedit "--version"
CheckFor robocopy CheckFor replace "--version"
CheckFor rsh CheckFor robocopy "--version"
CheckFor rsync CheckFor rsh "--version"
CheckFor rundll32 CheckFor rsync "--version"
CheckFor scp CheckFor rundll32 "--version"
CheckFor sftp CheckFor scp "--version"
CheckFor sha1sum CheckFor sftp "--version"
CheckFor sha256sum CheckFor sha1sum "--version"
CheckFor sha512sum CheckFor sha256sum "--version"
CheckFor ssh CheckFor sha512sum "--version"
CheckFor ssh-keygen CheckFor ssh "--version"
CheckFor sort CheckFor ssh-keygen "--version"
CheckFor split CheckFor sort "--version"
CheckFor strace CheckFor split "--version"
CheckFor strings CheckFor strace "--version"
CheckFor strip CheckFor strings "--version"
CheckFor sudo CheckFor strip "--version"
CheckFor tail CheckFor sudo "--version"
CheckFor tar CheckFor tail "--version"
CheckFor tasklist CheckFor tar "--version"
CheckFor tee CheckFor tasklist "--version"
CheckFor time CheckFor tee "--version"
CheckFor top CheckFor time "--version"
CheckFor tskill CheckFor top "--version"
CheckFor tzsync CheckFor tskill "--version"
CheckFor uniq CheckFor tzsync "--version"
CheckFor vi CheckFor uniq "--version"
CheckFor vim CheckFor vi "--version"
CheckFor vulkaninfo CheckFor vim "--version"
CheckFor waitfor CheckFor vulkaninfo "--version"
CheckFor wakeonlan CheckFor waitfor "--version"
CheckFor wget CheckFor wakeonlan "--version"
CheckFor where CheckFor wget "--version"
CheckFor whatis CheckFor where "--version"
CheckFor which CheckFor whatis "--version"
CheckFor whoami CheckFor which "--version"
CheckFor wput CheckFor whoami "--version"
CheckFor write CheckFor wput "--version"
CheckFor xcopy CheckFor write "--version"
CheckFor yes CheckFor xcopy "--version"
CheckFor zip CheckFor yes "--version"
CheckFor zipcloak CheckFor zip "--version"
CheckFor zipdetails CheckFor zipcloak "--version"
CheckFor zipgrep CheckFor zipdetails "--version"
CheckFor zipinfo CheckFor zipgrep "--version"
CheckFor zipnote CheckFor zipinfo "--version"
CheckFor zipsplit CheckFor zipnote "--version"
CheckFor zsh CheckFor zipsplit "--version"
CheckFor zsh "--version"
} }
try { try {