In my script I\'m about to run a command
pandoc -Ss readme.txt -o readme.html
But I\'m not sure if pandoc is installed. So I w
You can test through Get-Command (gcm)
if (Get-Command "pandoc.exe" -ErrorAction SilentlyContinue)
{
pandoc -Ss readme.txt -o readme.html
}
If you'd like to test the non-existence of a command in your path, for example to show an error message or download the executable (think NuGet):
if ((Get-Command "pandoc.exe" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "Unable to find pandoc.exe in your PATH"
}
Try
(Get-Help gcm).description
in a PowerShell session to get information about Get-Command.