79602645

Date: 2025-05-01 23:13:24
Score: 3
Natty:
Report link
get-command -CommandType Application | ? {$_.Name -like '7z.exe'}

get-command gets all known commands; the -like operator filters out what is needed , in this case '7z.exe'.

7z.exe is a Application (not a Powershell Cmdlet), thus the switch -CommandType Application . It may or may not have an entry in the registry.
Without the -Commandtype switch, you would get a clunky error (which you also manage with a try/catch block, that would be clunky)

Cheers, Sudhi

Reasons:
  • Blacklisted phrase (1): Cheers
  • Contains signature (1):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Sudhi