mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-04 22:38:34 +02:00
Update list-cli-tools.ps1
This commit is contained in:
parent
26c750bd05
commit
32bd7c2edf
@ -1,8 +1,8 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Lists installed CLI tools
|
Lists installed command-line tools
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script lists installed command-line interface (CLI) tools.
|
This PowerShell script lists all installed command-line tools (name/version/path/file size, sorted by name).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./list-cli-tools
|
PS> ./list-cli-tools
|
||||||
|
|
||||||
@ -16,13 +16,13 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function CheckFor { param([string]$Cmd, [string]$VersionArg)
|
function TryCmd { param([string]$Cmd, [string]$VersionArg)
|
||||||
try {
|
try {
|
||||||
$Info = Get-Command $Cmd -ErrorAction Stop
|
$Info = Get-Command $Cmd -ErrorAction Stop
|
||||||
$Path = $Info.Source
|
$Path = $Info.Source
|
||||||
if ("$($Info.Version)" -eq "0.0.0.0") {
|
if ("$($Info.Version)" -eq "0.0.0.0") {
|
||||||
if ("$VersionArg" -ne "") {
|
if ("$VersionArg" -ne "") {
|
||||||
$Result = invoke-expression "$Path $VersionArg"
|
$Result = Invoke-Expression "$Path $VersionArg"
|
||||||
if ("$Result" -match '\d+.\d+\.\d+') {
|
if ("$Result" -match '\d+.\d+\.\d+') {
|
||||||
$Version = "$($Matches[0])"
|
$Version = "$($Matches[0])"
|
||||||
} elseif ("$Result" -match '\d+\.\d+') {
|
} elseif ("$Result" -match '\d+\.\d+') {
|
||||||
@ -47,236 +47,236 @@ function CheckFor { param([string]$Cmd, [string]$VersionArg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ListTools {
|
function ListCmdTools {
|
||||||
CheckFor 7z "-version"
|
TryCmd 7z "-version"
|
||||||
CheckFor ant "-v"
|
TryCmd ant "-v"
|
||||||
CheckFor apt "--version"
|
TryCmd apt "--version"
|
||||||
CheckFor apt-get "--version"
|
TryCmd apt-get "--version"
|
||||||
CheckFor amixer "--version"
|
TryCmd amixer "--version"
|
||||||
CheckFor aplay "--version"
|
TryCmd aplay "--version"
|
||||||
CheckFor ar "--version"
|
TryCmd ar "--version"
|
||||||
CheckFor arch "--version"
|
TryCmd arch "--version"
|
||||||
CheckFor arecord "--version"
|
TryCmd arecord "--version"
|
||||||
CheckFor arp ""
|
TryCmd arp ""
|
||||||
CheckFor at ""
|
TryCmd at ""
|
||||||
CheckFor attrib ""
|
TryCmd attrib ""
|
||||||
CheckFor awk "--version"
|
TryCmd awk "--version"
|
||||||
CheckFor b2sum "--version"
|
TryCmd b2sum "--version"
|
||||||
CheckFor base32 "--version"
|
TryCmd base32 "--version"
|
||||||
CheckFor base64 "--version"
|
TryCmd base64 "--version"
|
||||||
CheckFor basename "--version"
|
TryCmd basename "--version"
|
||||||
CheckFor basenc "--version"
|
TryCmd basenc "--version"
|
||||||
CheckFor bash "--version"
|
TryCmd bash "--version"
|
||||||
CheckFor bc "--version"
|
TryCmd bc "--version"
|
||||||
CheckFor bunzip2 "--version"
|
TryCmd bunzip2 "--version"
|
||||||
CheckFor bzcat "--version"
|
TryCmd bzcat "--version"
|
||||||
CheckFor bzip2 "--version"
|
TryCmd bzip2 "--version"
|
||||||
CheckFor bzip2recover "--version"
|
TryCmd bzip2recover "--version"
|
||||||
CheckFor captoinfo "--version"
|
TryCmd captoinfo "-V"
|
||||||
CheckFor cat "-version"
|
TryCmd cat "-version"
|
||||||
CheckFor cc "--version"
|
TryCmd cc "--version"
|
||||||
CheckFor chattr "--version"
|
TryCmd chattr "--version"
|
||||||
CheckFor chcon "--version"
|
TryCmd chcon "--version"
|
||||||
CheckFor chdsk ""
|
TryCmd chdsk ""
|
||||||
CheckFor chgrp "--version"
|
TryCmd chgrp "--version"
|
||||||
CheckFor chmod "--version"
|
TryCmd chmod "--version"
|
||||||
CheckFor chkntfs ""
|
TryCmd chkntfs ""
|
||||||
CheckFor chown "--version"
|
TryCmd chown "--version"
|
||||||
CheckFor chroot "--version"
|
TryCmd chroot "--version"
|
||||||
CheckFor choco "--version"
|
TryCmd choco "--version"
|
||||||
CheckFor cipher ""
|
TryCmd cipher ""
|
||||||
CheckFor cksum "--version"
|
TryCmd cksum "--version"
|
||||||
CheckFor clang "--version"
|
TryCmd clang "--version"
|
||||||
CheckFor clear "--version"
|
TryCmd clear "-V"
|
||||||
CheckFor cmake "--version"
|
TryCmd cmake "--version"
|
||||||
CheckFor cmd ""
|
TryCmd cmd ""
|
||||||
CheckFor cmp "--version"
|
TryCmd cmp "--version"
|
||||||
CheckFor column "--version"
|
TryCmd column "--version"
|
||||||
CheckFor comp ""
|
TryCmd comp ""
|
||||||
CheckFor compact ""
|
TryCmd compact ""
|
||||||
CheckFor cp "--version"
|
TryCmd cp "--version"
|
||||||
CheckFor cpack "--version"
|
TryCmd cpack "--version"
|
||||||
CheckFor csplit "--version"
|
TryCmd csplit "--version"
|
||||||
CheckFor ctest "--version"
|
TryCmd ctest "--version"
|
||||||
CheckFor curl "--version"
|
TryCmd curl "--version"
|
||||||
CheckFor cut "--version"
|
TryCmd cut "--version"
|
||||||
CheckFor cygcheck "--version"
|
TryCmd cygcheck "--version"
|
||||||
CheckFor cygpath "--version"
|
TryCmd cygpath "--version"
|
||||||
CheckFor d2u "--version"
|
TryCmd d2u "--version"
|
||||||
CheckFor dash "--version"
|
TryCmd dash "--version"
|
||||||
CheckFor date ""
|
TryCmd date ""
|
||||||
CheckFor dd "--version"
|
TryCmd dd "--version"
|
||||||
CheckFor df "--version"
|
TryCmd df "--version"
|
||||||
CheckFor diff "--version"
|
TryCmd diff "--version"
|
||||||
CheckFor diff3 "--version"
|
TryCmd diff3 "--version"
|
||||||
CheckFor dir "--version"
|
TryCmd dir "--version"
|
||||||
CheckFor dircolors "--version"
|
TryCmd dircolors "--version"
|
||||||
CheckFor dirname "--version"
|
TryCmd dirname "--version"
|
||||||
CheckFor dism ""
|
TryCmd dism ""
|
||||||
CheckFor dos2unix "--version"
|
TryCmd dos2unix "--version"
|
||||||
CheckFor driverquery ""
|
TryCmd driverquery ""
|
||||||
CheckFor du "--version"
|
TryCmd du "--version"
|
||||||
CheckFor echo "--version"
|
TryCmd echo "--version"
|
||||||
CheckFor egrep "--version"
|
TryCmd egrep "--version"
|
||||||
CheckFor env "--version"
|
TryCmd env "--version"
|
||||||
CheckFor ex "--version"
|
TryCmd ex "--version"
|
||||||
CheckFor expand "--version"
|
TryCmd expand "--version"
|
||||||
CheckFor expr "--version"
|
TryCmd expr "--version"
|
||||||
CheckFor factor "--version"
|
TryCmd factor "--version"
|
||||||
CheckFor false "--version"
|
TryCmd false "--version"
|
||||||
CheckFor fido2-assert "--version"
|
TryCmd fido2-assert "--version"
|
||||||
CheckFor fido2-cred "--version"
|
TryCmd fido2-cred "--version"
|
||||||
CheckFor fido2-token "--version"
|
TryCmd fido2-token "--version"
|
||||||
CheckFor file "--version"
|
TryCmd file "--version"
|
||||||
CheckFor find "--version"
|
TryCmd find "--version"
|
||||||
CheckFor fgrep "--version"
|
TryCmd fgrep "--version"
|
||||||
CheckFor fmt "--version"
|
TryCmd fmt "--version"
|
||||||
CheckFor fold "--version"
|
TryCmd fold "--version"
|
||||||
CheckFor ftp "--version"
|
TryCmd ftp "-?"
|
||||||
CheckFor funzip "--version"
|
TryCmd funzip "--version"
|
||||||
CheckFor gawk "--version"
|
TryCmd gawk "--version"
|
||||||
CheckFor gencat "--version"
|
TryCmd gencat "--version"
|
||||||
CheckFor getconf "--version"
|
TryCmd getconf "--version"
|
||||||
CheckFor getopt "--version"
|
TryCmd getopt "--version"
|
||||||
CheckFor gettext "--version"
|
TryCmd gettext "--version"
|
||||||
CheckFor gcc "--version"
|
TryCmd gcc "--version"
|
||||||
CheckFor gdb "--version"
|
TryCmd gdb "--version"
|
||||||
CheckFor gh "--version"
|
TryCmd gh "--version"
|
||||||
CheckFor git "--version"
|
TryCmd git "--version"
|
||||||
CheckFor gkill "--version"
|
TryCmd gkill "--version"
|
||||||
CheckFor gmondump "--version"
|
TryCmd gmondump "--version"
|
||||||
CheckFor gpg "--version"
|
TryCmd gpg "--version"
|
||||||
CheckFor gpg-agent "--version"
|
TryCmd gpg-agent "--version"
|
||||||
CheckFor gpgconf "--version"
|
TryCmd gpgconf "--version"
|
||||||
CheckFor gpg-error "--version"
|
TryCmd gpg-error "--version"
|
||||||
CheckFor gpgsplit "--version"
|
TryCmd gpgsplit "--version"
|
||||||
CheckFor gpgtar "--version"
|
TryCmd gpgtar "--version"
|
||||||
CheckFor grep "--version"
|
TryCmd grep "--version"
|
||||||
CheckFor groups "--version"
|
TryCmd groups "--version"
|
||||||
CheckFor gzip "--version"
|
TryCmd gzip "--version"
|
||||||
CheckFor head "--version"
|
TryCmd head "--version"
|
||||||
CheckFor hcsdiag ""
|
TryCmd hcsdiag ""
|
||||||
CheckFor help "--version"
|
TryCmd help "--version"
|
||||||
CheckFor hmac256 "--version"
|
TryCmd hmac256 "--version"
|
||||||
CheckFor hostid "--version"
|
TryCmd hostid "--version"
|
||||||
CheckFor hostname ""
|
TryCmd hostname ""
|
||||||
CheckFor htop "--version"
|
TryCmd htop "--version"
|
||||||
CheckFor iconv "--version"
|
TryCmd iconv "--version"
|
||||||
CheckFor id "--version"
|
TryCmd id "--version"
|
||||||
CheckFor ipfs "--version"
|
TryCmd ipfs "--version"
|
||||||
CheckFor java "--version"
|
TryCmd java "--version"
|
||||||
CheckFor join "--version"
|
TryCmd join "--version"
|
||||||
CheckFor kill "--version"
|
TryCmd kill "--version"
|
||||||
CheckFor ldd "--version"
|
TryCmd ldd "--version"
|
||||||
CheckFor less "--version"
|
TryCmd less "--version"
|
||||||
CheckFor link "--version"
|
TryCmd link "--version"
|
||||||
CheckFor ln "--version"
|
TryCmd ln "--version"
|
||||||
CheckFor locale "--version"
|
TryCmd locale "--version"
|
||||||
CheckFor locate "--version"
|
TryCmd locate "--version"
|
||||||
CheckFor logname "--version"
|
TryCmd logname "--version"
|
||||||
CheckFor ls "--version"
|
TryCmd ls "--version"
|
||||||
CheckFor lsattr "--version"
|
TryCmd lsattr "-V"
|
||||||
CheckFor lsb_release ""
|
TryCmd lsb_release ""
|
||||||
CheckFor lzma "--version"
|
TryCmd lzma "--version"
|
||||||
CheckFor mac2unix "--version"
|
TryCmd mac2unix "--version"
|
||||||
CheckFor make "--version"
|
TryCmd make "--version"
|
||||||
CheckFor md5sum "--version"
|
TryCmd md5sum "--version"
|
||||||
CheckFor minidumper "--version"
|
TryCmd minidumper "--version"
|
||||||
CheckFor mkdir "--version"
|
TryCmd mkdir "--version"
|
||||||
CheckFor mkfifo "--version"
|
TryCmd mkfifo "--version"
|
||||||
CheckFor mkgroup "--version"
|
TryCmd mkgroup "--version"
|
||||||
CheckFor mknod "--version"
|
TryCmd mknod "--version"
|
||||||
CheckFor mkpasswd "--version"
|
TryCmd mkpasswd "--version"
|
||||||
CheckFor mktemp "--version"
|
TryCmd mktemp "--version"
|
||||||
CheckFor mount "--version"
|
TryCmd mount "--version"
|
||||||
CheckFor MpCmdRun "-h"
|
TryCmd MpCmdRun "-h"
|
||||||
CheckFor netsh ""
|
TryCmd netsh ""
|
||||||
CheckFor netstat ""
|
TryCmd netstat ""
|
||||||
CheckFor nice "--version"
|
TryCmd nice "--version"
|
||||||
CheckFor nohup "--version"
|
TryCmd nohup "--version"
|
||||||
CheckFor nroff "--version"
|
TryCmd nroff "--version"
|
||||||
CheckFor nslookup ""
|
TryCmd nslookup ""
|
||||||
CheckFor openssl ""
|
TryCmd openssl ""
|
||||||
CheckFor passwd "--version"
|
TryCmd passwd "--status"
|
||||||
CheckFor paste "--version"
|
TryCmd paste "--version"
|
||||||
CheckFor perl "--version"
|
TryCmd perl "--version"
|
||||||
CheckFor ping "-V"
|
TryCmd ping "-V"
|
||||||
CheckFor ping6 "-V"
|
TryCmd ping6 "-V"
|
||||||
CheckFor pip "--version"
|
TryCmd pip "--version"
|
||||||
CheckFor pip3 "--version"
|
TryCmd pip3 "--version"
|
||||||
CheckFor pip3.8 "--version"
|
TryCmd pip3.8 "--version"
|
||||||
CheckFor powercfg "/?"
|
TryCmd powercfg "/?"
|
||||||
CheckFor powershell "--version"
|
TryCmd powershell "--version"
|
||||||
CheckFor print ""
|
TryCmd print ""
|
||||||
CheckFor printf "--version"
|
TryCmd printf "--version"
|
||||||
CheckFor python "--version"
|
TryCmd python "--version"
|
||||||
CheckFor python3 "--version"
|
TryCmd python3 "--version"
|
||||||
CheckFor python3.8 "--version"
|
TryCmd python3.8 "--version"
|
||||||
CheckFor rasdial "--version"
|
TryCmd rasdial "--version"
|
||||||
CheckFor regedit "--version"
|
TryCmd regedit "--version"
|
||||||
CheckFor replace "--version"
|
TryCmd replace "--version"
|
||||||
CheckFor robocopy "--version"
|
TryCmd robocopy "--version"
|
||||||
CheckFor route ""
|
TryCmd route ""
|
||||||
CheckFor rsh ""
|
TryCmd rsh ""
|
||||||
CheckFor rsync "--version"
|
TryCmd rsync "--version"
|
||||||
CheckFor rundll32 "--version"
|
TryCmd rundll32 "--version"
|
||||||
CheckFor scp ""
|
TryCmd scp ""
|
||||||
CheckFor sftp ""
|
TryCmd sftp ""
|
||||||
CheckFor sh "--version"
|
TryCmd sh "--version"
|
||||||
CheckFor sha1sum "--version"
|
TryCmd sha1sum "--version"
|
||||||
CheckFor sha256sum "--version"
|
TryCmd sha256sum "--version"
|
||||||
CheckFor sha512sum "--version"
|
TryCmd sha512sum "--version"
|
||||||
CheckFor ssh ""
|
TryCmd ssh "-V"
|
||||||
CheckFor ssh-keygen ""
|
TryCmd ssh-keygen ""
|
||||||
CheckFor sort "--version"
|
TryCmd sort "--version"
|
||||||
CheckFor split "--version"
|
TryCmd split "--version"
|
||||||
CheckFor strace "--version"
|
TryCmd strace "--version"
|
||||||
CheckFor strings "--version"
|
TryCmd strings "--version"
|
||||||
CheckFor strip "--version"
|
TryCmd strip "--version"
|
||||||
CheckFor sudo "--version"
|
TryCmd sudo "--version"
|
||||||
CheckFor systeminfo ""
|
TryCmd systeminfo ""
|
||||||
CheckFor tail "--version"
|
TryCmd tail "--version"
|
||||||
CheckFor tar "--version"
|
TryCmd tar "--version"
|
||||||
CheckFor taskkill ""
|
TryCmd taskkill ""
|
||||||
CheckFor tasklist ""
|
TryCmd tasklist ""
|
||||||
CheckFor tee "--version"
|
TryCmd tee "--version"
|
||||||
CheckFor time ""
|
TryCmd time ""
|
||||||
CheckFor timeout ""
|
TryCmd timeout ""
|
||||||
CheckFor top "-v"
|
TryCmd top "-v"
|
||||||
CheckFor tskill ""
|
TryCmd tskill ""
|
||||||
CheckFor typeperf ""
|
TryCmd typeperf ""
|
||||||
CheckFor tzsync "--version"
|
TryCmd tzsync "--version"
|
||||||
CheckFor uniq "--version"
|
TryCmd uniq "--version"
|
||||||
CheckFor vi "--version"
|
TryCmd vi "--version"
|
||||||
CheckFor vim "--version"
|
TryCmd vim "--version"
|
||||||
CheckFor vulkaninfo "--version"
|
TryCmd vulkaninfo "--version"
|
||||||
CheckFor w32tm "/?"
|
TryCmd w32tm "/?"
|
||||||
CheckFor waitfor "--version"
|
TryCmd waitfor "--version"
|
||||||
CheckFor wakeonlan ""
|
TryCmd wakeonlan ""
|
||||||
CheckFor wget "--version"
|
TryCmd wget "--version"
|
||||||
CheckFor where "--version"
|
TryCmd where "--version"
|
||||||
CheckFor whatis "--version"
|
TryCmd whatis "--version"
|
||||||
CheckFor which ""
|
TryCmd which ""
|
||||||
CheckFor winget "--version"
|
TryCmd winget "--version"
|
||||||
CheckFor winsat ""
|
TryCmd winsat ""
|
||||||
CheckFor whoami "--version"
|
TryCmd whoami "--version"
|
||||||
CheckFor wput "--version"
|
TryCmd wput "--version"
|
||||||
CheckFor write ""
|
TryCmd write ""
|
||||||
CheckFor wsl "--version"
|
TryCmd wsl "--version"
|
||||||
CheckFor xcopy "--version"
|
TryCmd xcopy "--version"
|
||||||
CheckFor yes "--version"
|
TryCmd yes "--version"
|
||||||
CheckFor zip "--version"
|
TryCmd zip "--version"
|
||||||
CheckFor zipcloak "--version"
|
TryCmd zipcloak "--version"
|
||||||
CheckFor zipdetails ""
|
TryCmd zipdetails ""
|
||||||
CheckFor zipgrep ""
|
TryCmd zipgrep ""
|
||||||
CheckFor zipinfo ""
|
TryCmd zipinfo ""
|
||||||
CheckFor zipnote ""
|
TryCmd zipnote ""
|
||||||
CheckFor zipsplit ""
|
TryCmd zipsplit ""
|
||||||
CheckFor zsh "--version"
|
TryCmd zsh "--version"
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ListTools | Format-Table -property @{e='Name';width=12},@{e='Version';width=15},@{e='Path';width=70},@{e='FileSize';width=10}
|
ListCmdTools | Format-Table -property @{e='Name';width=12},@{e='Version';width=15},@{e='Path';width=70},@{e='FileSize';width=10}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user