What does the "cat" command in Powershell mean?

Viewed 11264
powershell.exe -ExecutionPolicy Bypass -C "get-process >> $env:APPDATA\test.log; cat $env:APPDATA\test.log"

Hi everyone, can someone translate what cat is in powershell? or if you're extra nice tell me what the whole script is saying? I ran it in my VM but I'm still not understanding it.

2 Answers

PowerShell has rich reflection capabilities.

To learn what a given command refers to, use the Get-Command cmdlet:

# On *Windows*
PS> Get-Command cat

CommandType     Name                                               Version    Source                                                                           
-----------     ----                                               -------    ------                                                                           
Alias           cat -> Get-Content                                                                                                                             

This tells you that cat is an alias for the Get-Content cmdlet.

# On *Unix*-like platforms (macOS, Linux)
PS> Get-Command cat

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     cat                                                0.0.0.0    /bin/cat

This tells you that cat refers to the external program (application) located at /bin/cat (the standard cat Unix utility).

PS> Get-Alias cat

CommandType     Name                                               Version    Source                                                                       
-----------     ----                                               -------    ------                                                                       
Alias           cat -> Get-Content                                                                                                                         

It is an alias to Get-Content command in powershell

Related