2021-09-27 10:38:12 +02:00
|
|
|
|
<#
|
2021-07-22 10:49:42 +02:00
|
|
|
|
.SYNOPSIS
|
2022-11-21 21:42:41 +01:00
|
|
|
|
Lists installed command-line tools
|
2021-10-04 21:29:23 +02:00
|
|
|
|
.DESCRIPTION
|
2022-12-25 22:29:33 +01:00
|
|
|
|
This PowerShell script lists installed command-line tools sorted by name.
|
2021-07-22 10:49:42 +02:00
|
|
|
|
.EXAMPLE
|
2021-09-24 17:19:49 +02:00
|
|
|
|
PS> ./list-cli-tools
|
2021-09-29 21:50:10 +02:00
|
|
|
|
|
2022-09-27 14:02:28 +02:00
|
|
|
|
Name Version Path FileSize
|
|
|
|
|
---- ------- ---- --------
|
|
|
|
|
at 10.0.19041.1 C:\WINDOWS\system32\at.exe 31232
|
2021-09-29 21:50:10 +02:00
|
|
|
|
...
|
2021-07-22 10:49:42 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2022-01-29 12:47:46 +01:00
|
|
|
|
.NOTES
|
2022-03-29 07:37:01 +02:00
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-07-22 10:49:42 +02:00
|
|
|
|
#>
|
|
|
|
|
|
2022-12-25 22:29:33 +01:00
|
|
|
|
function Test { param([string]$Cmd, [string]$VersionArg)
|
2021-07-22 20:04:58 +02:00
|
|
|
|
try {
|
|
|
|
|
$Info = Get-Command $Cmd -ErrorAction Stop
|
2022-09-27 14:02:28 +02:00
|
|
|
|
$Path = $Info.Source
|
2021-08-02 08:39:17 +02:00
|
|
|
|
if ("$($Info.Version)" -eq "0.0.0.0") {
|
2021-07-28 14:48:57 +02:00
|
|
|
|
if ("$VersionArg" -ne "") {
|
2022-11-21 21:42:41 +01:00
|
|
|
|
$Result = Invoke-Expression "$Path $VersionArg"
|
2021-08-02 08:39:17 +02:00
|
|
|
|
if ("$Result" -match '\d+.\d+\.\d+') {
|
|
|
|
|
$Version = "$($Matches[0])"
|
|
|
|
|
} elseif ("$Result" -match '\d+\.\d+') {
|
2021-07-28 14:48:57 +02:00
|
|
|
|
$Version = "$($Matches[0])"
|
|
|
|
|
} else {
|
2021-08-02 08:39:17 +02:00
|
|
|
|
$Version = ""
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$Version = ""
|
2021-07-26 20:09:48 +02:00
|
|
|
|
}
|
2021-08-02 08:39:17 +02:00
|
|
|
|
} else {
|
|
|
|
|
$Version = $Info.Version
|
2021-07-26 20:09:48 +02:00
|
|
|
|
}
|
2022-09-27 14:02:28 +02:00
|
|
|
|
if (Test-Path "$Path" -pathType leaf) {
|
|
|
|
|
$FileSize = (Get-Item "$Path").Length
|
2021-07-22 20:04:58 +02:00
|
|
|
|
} else {
|
|
|
|
|
$FileSize = "0"
|
|
|
|
|
}
|
2022-09-27 14:02:28 +02:00
|
|
|
|
New-Object PSObject -Property @{ Name=$Cmd; Version=$Version; Path=$Path; FileSize=$FileSize }
|
2021-07-22 20:04:58 +02:00
|
|
|
|
} catch {
|
|
|
|
|
return
|
|
|
|
|
}
|
2021-07-22 10:49:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-21 21:42:41 +01:00
|
|
|
|
function ListCmdTools {
|
2022-12-25 22:29:33 +01:00
|
|
|
|
Test 7z "-version"
|
|
|
|
|
Test ant "-v"
|
|
|
|
|
Test apt "--version"
|
|
|
|
|
Test apt-get "--version"
|
|
|
|
|
Test amixer "--version"
|
|
|
|
|
Test aplay "--version"
|
|
|
|
|
Test apropos "--version"
|
|
|
|
|
Test ar "--version"
|
|
|
|
|
Test arch "--version"
|
|
|
|
|
Test arecord "--version"
|
|
|
|
|
Test arp ""
|
|
|
|
|
Test at ""
|
|
|
|
|
Test attrib ""
|
|
|
|
|
Test awk "--version"
|
|
|
|
|
Test b2sum "--version"
|
|
|
|
|
Test base32 "--version"
|
|
|
|
|
Test base64 "--version"
|
|
|
|
|
Test basename "--version"
|
|
|
|
|
Test basenc "--version"
|
|
|
|
|
Test bash "--version"
|
|
|
|
|
Test bc "--version"
|
|
|
|
|
Test bunzip2 "--version"
|
|
|
|
|
Test bzcat "--version"
|
|
|
|
|
Test bzip2 "--version"
|
|
|
|
|
Test bzip2recover "--version"
|
|
|
|
|
Test captoinfo "-V"
|
|
|
|
|
Test cat "-version"
|
|
|
|
|
Test cc "--version"
|
|
|
|
|
Test chattr "--version"
|
|
|
|
|
Test chcon "--version"
|
|
|
|
|
Test chcpu "--version"
|
|
|
|
|
Test chdsk ""
|
|
|
|
|
Test chgrp "--version"
|
|
|
|
|
Test chmod "--version"
|
|
|
|
|
Test chkntfs ""
|
|
|
|
|
Test chmem "--version"
|
|
|
|
|
Test chown "--version"
|
|
|
|
|
Test chpasswd "--version"
|
|
|
|
|
Test chroot "--version"
|
|
|
|
|
Test choco "--version"
|
|
|
|
|
Test cipher ""
|
|
|
|
|
Test cksum "--version"
|
|
|
|
|
Test clang "--version"
|
|
|
|
|
Test clear "-V"
|
|
|
|
|
Test cmake "--version"
|
|
|
|
|
Test cmd ""
|
|
|
|
|
Test cmp "--version"
|
|
|
|
|
Test column "--version"
|
|
|
|
|
Test comp ""
|
|
|
|
|
Test compact ""
|
|
|
|
|
Test cp "--version"
|
|
|
|
|
Test cpack "--version"
|
|
|
|
|
Test csplit "--version"
|
|
|
|
|
Test ctest "--version"
|
|
|
|
|
Test curl "--version"
|
|
|
|
|
Test cut "--version"
|
|
|
|
|
Test cygcheck "--version"
|
|
|
|
|
Test cygpath "--version"
|
|
|
|
|
Test d2u "--version"
|
|
|
|
|
Test dash "--version"
|
|
|
|
|
Test date ""
|
|
|
|
|
Test dd "--version"
|
|
|
|
|
Test delgroup "--version"
|
|
|
|
|
Test deluser "--version"
|
|
|
|
|
Test df "--version"
|
|
|
|
|
Test diff "--version"
|
|
|
|
|
Test diff3 "--version"
|
|
|
|
|
Test dir "--version"
|
|
|
|
|
Test dircolors "--version"
|
|
|
|
|
Test dirname "--version"
|
|
|
|
|
Test dism ""
|
2022-12-28 11:20:07 +01:00
|
|
|
|
Test dmidecode "--version"
|
2022-12-25 22:29:33 +01:00
|
|
|
|
Test dos2unix "--version"
|
|
|
|
|
Test driverquery ""
|
|
|
|
|
Test du "--version"
|
|
|
|
|
Test echo "--version"
|
|
|
|
|
Test egrep "--version"
|
|
|
|
|
Test env "--version"
|
|
|
|
|
Test ex "--version"
|
|
|
|
|
Test expand "--version"
|
|
|
|
|
Test expr "--version"
|
|
|
|
|
Test factor "--version"
|
|
|
|
|
Test false "--version"
|
|
|
|
|
Test fido2-assert "--version"
|
|
|
|
|
Test fido2-cred "--version"
|
|
|
|
|
Test fido2-token "--version"
|
|
|
|
|
Test file "--version"
|
|
|
|
|
Test find "--version"
|
|
|
|
|
Test fish "--version"
|
|
|
|
|
Test fgrep "--version"
|
|
|
|
|
Test fmt "--version"
|
|
|
|
|
Test fold "--version"
|
|
|
|
|
Test ftp "-?"
|
|
|
|
|
Test funzip "--version"
|
|
|
|
|
Test gawk "--version"
|
|
|
|
|
Test gencat "--version"
|
|
|
|
|
Test getconf "--version"
|
|
|
|
|
Test getopt "--version"
|
|
|
|
|
Test gettext "--version"
|
|
|
|
|
Test gcc "--version"
|
|
|
|
|
Test gdb "--version"
|
|
|
|
|
Test gh "--version"
|
|
|
|
|
Test git "--version"
|
|
|
|
|
Test gkill "--version"
|
|
|
|
|
Test gmondump "--version"
|
|
|
|
|
Test gpg "--version"
|
|
|
|
|
Test gpg-agent "--version"
|
|
|
|
|
Test gpgconf "--version"
|
|
|
|
|
Test gpg-error "--version"
|
|
|
|
|
Test gpgsplit "--version"
|
|
|
|
|
Test gpgtar "--version"
|
|
|
|
|
Test grep "--version"
|
|
|
|
|
Test groups "--version"
|
|
|
|
|
Test gzip "--version"
|
|
|
|
|
Test head "--version"
|
|
|
|
|
Test hcsdiag ""
|
|
|
|
|
Test help "--version"
|
|
|
|
|
Test hmac256 "--version"
|
|
|
|
|
Test hostid "--version"
|
|
|
|
|
Test hostname ""
|
|
|
|
|
Test htop "--version"
|
|
|
|
|
Test icacls "--version"
|
|
|
|
|
Test iconv "--version"
|
|
|
|
|
Test id "--version"
|
|
|
|
|
Test ipfs "--version"
|
|
|
|
|
Test java "--version"
|
|
|
|
|
Test join "--version"
|
|
|
|
|
Test kill "--version"
|
|
|
|
|
Test ldd "--version"
|
|
|
|
|
Test less "--version"
|
|
|
|
|
Test link "--version"
|
|
|
|
|
Test ln "--version"
|
|
|
|
|
Test locale "--version"
|
|
|
|
|
Test locate "--version"
|
|
|
|
|
Test logname "--version"
|
|
|
|
|
Test ls "--version"
|
|
|
|
|
Test lsattr "-V"
|
|
|
|
|
Test lsb_release ""
|
|
|
|
|
Test lzma "--version"
|
|
|
|
|
Test mac2unix "--version"
|
|
|
|
|
Test make "--version"
|
|
|
|
|
Test md5sum "--version"
|
|
|
|
|
Test minidumper "--version"
|
|
|
|
|
Test mkdir "--version"
|
|
|
|
|
Test mkfifo "--version"
|
|
|
|
|
Test mkgroup "--version"
|
|
|
|
|
Test mknod "--version"
|
|
|
|
|
Test mkpasswd "--version"
|
|
|
|
|
Test mktemp "--version"
|
|
|
|
|
Test mount "--version"
|
|
|
|
|
Test MpCmdRun "-h"
|
2022-12-25 22:44:14 +01:00
|
|
|
|
Test nano "--version"
|
2022-12-25 22:29:33 +01:00
|
|
|
|
Test netsh ""
|
|
|
|
|
Test netstat ""
|
|
|
|
|
Test nice "--version"
|
|
|
|
|
Test nohup "--version"
|
|
|
|
|
Test nroff "--version"
|
|
|
|
|
Test nslookup ""
|
|
|
|
|
Test openssl ""
|
|
|
|
|
Test passwd "--status"
|
|
|
|
|
Test paste "--version"
|
|
|
|
|
Test perl "--version"
|
|
|
|
|
Test ping "-V"
|
|
|
|
|
Test ping6 "-V"
|
|
|
|
|
Test pip "--version"
|
|
|
|
|
Test pip3 "--version"
|
|
|
|
|
Test pip3.8 "--version"
|
|
|
|
|
Test powercfg "/?"
|
|
|
|
|
Test powershell "--version"
|
|
|
|
|
Test print ""
|
|
|
|
|
Test printf "--version"
|
|
|
|
|
Test pro "--version"
|
|
|
|
|
Test python "--version"
|
|
|
|
|
Test python3 "--version"
|
|
|
|
|
Test python3.8 "--version"
|
|
|
|
|
Test rasdial "--version"
|
|
|
|
|
Test regedit "--version"
|
|
|
|
|
Test replace "--version"
|
|
|
|
|
Test robocopy "--version"
|
|
|
|
|
Test route ""
|
|
|
|
|
Test rsh ""
|
|
|
|
|
Test rsync "--version"
|
|
|
|
|
Test rundll32 "--version"
|
|
|
|
|
Test scp ""
|
|
|
|
|
Test sftp ""
|
|
|
|
|
Test sh "--version"
|
|
|
|
|
Test sha1sum "--version"
|
|
|
|
|
Test sha256sum "--version"
|
|
|
|
|
Test sha512sum "--version"
|
|
|
|
|
Test ssh "-V"
|
|
|
|
|
Test ssh-keygen ""
|
|
|
|
|
Test smartctl "--version"
|
|
|
|
|
Test sort "--version"
|
|
|
|
|
Test split "--version"
|
|
|
|
|
Test strace "--version"
|
|
|
|
|
Test strings "--version"
|
|
|
|
|
Test strip "--version"
|
|
|
|
|
Test sudo "--version"
|
|
|
|
|
Test systeminfo ""
|
|
|
|
|
Test tail "--version"
|
|
|
|
|
Test tar "--version"
|
|
|
|
|
Test taskkill ""
|
|
|
|
|
Test tasklist ""
|
|
|
|
|
Test tee "--version"
|
|
|
|
|
Test time ""
|
|
|
|
|
Test timeout ""
|
|
|
|
|
Test top "-v"
|
|
|
|
|
Test tskill ""
|
|
|
|
|
Test typeperf ""
|
|
|
|
|
Test tzsync "--version"
|
|
|
|
|
Test uniq "--version"
|
|
|
|
|
Test vi "--version"
|
|
|
|
|
Test vim "--version"
|
|
|
|
|
Test vulkaninfo "--version"
|
|
|
|
|
Test w32tm "/?"
|
|
|
|
|
Test waitfor "--version"
|
|
|
|
|
Test wakeonlan ""
|
|
|
|
|
Test wget "--version"
|
|
|
|
|
Test where "--version"
|
|
|
|
|
Test whatis "--version"
|
|
|
|
|
Test which ""
|
|
|
|
|
Test winget "--version"
|
|
|
|
|
Test winsat ""
|
|
|
|
|
Test whoami "--version"
|
|
|
|
|
Test wput "--version"
|
|
|
|
|
Test write ""
|
|
|
|
|
Test wsl "--version"
|
|
|
|
|
Test xcopy "--version"
|
|
|
|
|
Test yes "--version"
|
|
|
|
|
Test zip "--version"
|
|
|
|
|
Test zipcloak "--version"
|
|
|
|
|
Test zipdetails ""
|
|
|
|
|
Test zipgrep ""
|
|
|
|
|
Test zipinfo ""
|
|
|
|
|
Test zipnote ""
|
|
|
|
|
Test zipsplit ""
|
|
|
|
|
Test zsh "--version"
|
2021-07-22 10:49:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
2022-11-21 21:42:41 +01:00
|
|
|
|
ListCmdTools | Format-Table -property @{e='Name';width=12},@{e='Version';width=15},@{e='Path';width=70},@{e='FileSize';width=10}
|
2021-09-27 10:09:45 +02:00
|
|
|
|
exit 0 # success
|
2021-07-22 10:49:42 +02:00
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-07-22 10:49:42 +02:00
|
|
|
|
exit 1
|
2022-11-21 21:42:41 +01:00
|
|
|
|
}
|