PowerShell commands
Updated: 03/10/2024 by Computer Hope
A listing of the more widely-used PowerShell commands and a brief explanation about each command is provided below. Some commands can be referenced by an alias or cmdlet name, while other commands can only be referenced by a cmdlet name.
PowerShell commands by alias and cmdlet
Command alias | Cmdlet name | Description |
---|---|---|
ac | Add-Content | Add content, like text, to a file. |
cat | Get-Content | Get the contents of a file. |
cd | Set-Location | Set a specific directory, or location, as the working directory. |
chdir | Set-Location | Set a specific directory, or location, as the working directory. |
clc | Clear-Content | Delete, or clears, the contents of a specified object, like a file, but leaves the object itself. |
clear | Clear-Host | Clear the screen, or display, of the host application. |
cli | Clear-Item | Delete, or clear, the contents of a specified object, like a file, but leaves the object itself. |
clp | Clear-ItemProperty | Delete the contents, or value, of a property, but leaves the property itself. |
cls | Clear-Host | Clear the screen, or display, of the host application. |
clv | Clear-Variable | Delete the contents, or value, of a variable. |
cnsn | Connect-PSSession | Reconnect to a disconnected PowerShell session. |
compare | Compare-Object | Compare the contents of two objects. |
copy | Copy-Item | Copy an object, like a file, from one directory, or location, to another directory. |
cp | Copy-Item | Copy an object, like a file, from one directory, or location, to another directory. |
cpi | Copy-Item | Copy an object, like a file, from one directory, or location, to another directory. |
curl | Invoke-WebRequest | Retrieve content, like images and text, from a web page. |
dbp | Disable-PSBreakpoint | Disable breakpoints in the PowerShell console. |
del | Remove-Item | Delete an object, like a file or folder. |
diff | Compare-Object | Compare the contents of two objects. |
dir | Get-ChildItem | Display a list of objects in a specific directory or drive. |
dnsn | Disconnect-PSSession | Disconnect from a PowerShell session. |
ebp | Enable-PSBreakpoint | Enable breakpoints in the PowerShell console. |
echo | Write-Output | Sends the output of a command to the next command for execution. Or displays the output to the screen if it's the last command to be executed. |
epcsv | Export-Csv | Convert data into comma-separated value strings, then save the strings to a CSV (Comma-Separated Values) file. |
erase | Remove-Item | Delete an object, like a file or folder. |
etsn | Enter-PSSession | Start a remote connection to another computer. |
exsn | Exit-PSSession | End a remote connection to another computer. |
foreach | ForEach-Object | Loop through a set of objects, executing commands against each object. |
ft | Format-Table | Formats the output of a command into a table. |
gal | Get-Alias | Get the aliases for the current PowerShell session. |
gc | Get-Content | Get the contents of a file. |
gci | Get-ChildItem | Display a list of objects in a specific directory or drive. |
gcm | Get-Command | Get all PowerShell commands. |
ghy | Get-History | Get a list of all PowerShell commands used during the current PowerShell session. |
gjb | Get-Job | Display, or get, a list of all background jobs running in the current PowerShell session. |
gl | Get-Location | Get information about the current directory or another specified directory. |
gm | Get-Member | Get the properties and methods associated with a specific object. |
gp | Get-ItemProperty | Get the properties of a specific object. |
gps | Get-Process | Get a list of processes that are running on a computer. |
gsnp | Get-PSSnapIn | Get a list of PowerShell snap-ins that are installed on a computer. |
gsv | Get-Service | Get a list of services that are running on a computer. |
gu | Get-Unique | Get a list of unique values from a sorted list of values. |
h | Get-History | Get a list of all PowerShell commands used during the current PowerShell session. |
history | Get-History | Get a list of all PowerShell commands used during the current PowerShell session. |
icm | Invoke-Command | Execute a command on a local or remote computer. |
iex | Invoke-Expression | Execute a command or expression on a local computer. |
ihy | Invoke-History | Execute a command previously run during the current PowerShell session. |
ipal | Import-Alias | Import aliases from a file. |
ipmo | Import-Module | Import a module into the current PowerShell session. |
irm | Invoke-RestMethod | Execute REST (Representational State Transfer) web service call, from an HTTP (HyperText Transfer Protocol) or HTTPS request. |
iwr | Invoke-WebRequest | Retrieve content, like images and text, from a web page. |
kill | Stop-Process | Stop a running process on a computer. |
lp | Out-Printer | Send data to a printer for printing. |
ls | Get-ChildItem | Display a list of objects in a specific directory or drive. |
man | help | Display information about available PowerShell commands. |
md | mkdir | Create a new directory in the current or specified directory. |
measure | Measure-Object | Counts the number of characters, words, and lines in a file or string of text. |
mi | Move-Item | Move an object from one directory to another directory. |
mount | New-PSDrive | Create a mapped drive using network storage. |
move | Move-Item | Move an object from one directory to another directory. |
mv | Move-Item | Move an object from one directory to another directory. |
nal | New-Alias | Create a new alias. |
ndr | New-PSDrive | Create a mapped drive using network storage. |
ni | New-Item | Create a new object based on its location, like a file or folder in a file system, or a registry key in the system registry. |
nsn | New-PSSession | Create a new, persistent connection to a computer. |
nv | New-Variable | Create a new variable for the current PowerShell session. |
oh | Out-Host | Send data output to the host computer's command line. |
ps | Get-Process | Get a list of processes that are running on a computer. |
pwd | Get-Location | Get information about the current directory or another specified directory. |
rbp | Remove-PSBreakpoint | Delete a breakpoint in the PowerShell console. |
rcsn | Receive-PSSession | Get the results from a command run in a disconnected PowerShell session. |
rd | Remove-Item | Delete an object, like a file or folder. |
rdr | Remove-PSDrive | Delete drive or disconnect mounted network drive from current PowerShell session. |
ren | Rename-Item | Rename an object in the current PowerShell session. |
ri | Remove-Item | Delete an object, like a file or folder. |
rjb | Remove-Job | Delete a job in the PowerShell background. |
rm | Remove-Item | Delete an object, like a file or folder. |
rmdir | Remove-Item | Delete an object, like a file or folder. |
rni | Rename-Item | Rename an object in the current PowerShell session. |
rsn | Remove-PSSession | Close a PowerShell session. |
rv | Remove-Variable | Delete a variable and the value stored in the variable. |
sajb | Start-Job | Start a job in the PowerShell background. |
saps | Start-Process | Start a process on the local computer. |
sasv | Start-Service | Start a service that is currently stopped on a computer. |
sbp | Set-PSBreakpoint | Create a breakpoint at a specific command, line, or variable in the PowerShell console. |
sc | Set-Content | Replace a file's contents with the specified content. |
select | Select-Object | Select an object in the PowerShell session. |
set | Set-Variable | Set a value to an existing variable, or create a new variable with a specified value if the variable does not exist. |
spsv | Stop-Service | Stop a service that is currently running on a computer. |
PowerShell commands by cmdlet only
Cmdlet name | Description |
---|---|
# | Comment a line of code, to not execute it. |
& | Execute a PowerShell command, function, or script. |
Break | Immediately exit a for, foreach, do, or other program loops. |
Debug-Process | Add debugging to a host process. |
Enable-PSRemoting | Execute a PowerShell command on a remote computer. |
Export-Console | Export the configuration of the console to a file. |
For | Loop through a set of items that meet specific conditions. |
ForEach | Loops through all items in a set of items. |
Get-Culture | Get regional information about the local computer, including language. |
Get-Date | Get the current date and time on the local computer. |
Get-Event | Get all events from the event queue of the PowerShell session. |
Get-Host | Get PowerShell version and region information from the host computer. |
Invoke-Command | Execute a command on a local or remote computer. |
New-Event | Create a new event in the PowerShell session. |
New-Object | Create a .NET object. |
Out-File | Send output of a command to a specific file. |
Pause | Pause commands or entire program. Display message "Press Enter to continue." |
PowerShell | Start a PowerShell session or run a PowerShell script. |
Register-ScheduledJob | Create a scheduled job on a computer. |
Restart-Service | Stop, then start a service. |
Remove-Event | Delete an event from the event queue of the PowerShell session. |
Send-MailMessage | Send an e-mail message. |
Set-Date | Set the date and time on the local computer. |
Test-Path | Test if a specific path exists. Returns "true" if path exists or "false" if path does not exist. |
Try - Catch | Try executing code and handle any error that occurs. |
Unregister-ScheduledJob | Delete a scheduled job on a computer. |
While | Loop through a set of items while a condition is met. |
Write-Host | Send custom output to the host computer or display. |
Write-Progress | Display a progress bar on the screen. |
Zipfile | Compress files into a Zip file or extract files from a Zip file. |