Powershell: Difference between revisions

From miki
Jump to navigation Jump to search
Line 5: Line 5:
<source lang="powershell">
<source lang="powershell">
# Documentation
# Documentation
Update-Help # Update help system - to run as Administrator
Update-Help # Update help system - to run as Administrator
help Test-Path # Get help on a command
help Test-Path # Get help on a command, on an alias...
help Test-Path -full # ... and on all options
help Test-Path -full # ... and on all options
help Test-Path -examples # ... see examples. VERY USEFUL


Get-Command about_* # DOES NOT WORK
Get-Command about_* # DOES NOT WORK
Get-Command -Verb Add
Get-Command -Verb Add
Get-Alias ps # ... Get-Process
Get-Alias ps # ... Get-Process
Get-Alias -Definition Get-Process # ... ps
Get-Alias -Definition Get-Process # ... ps
ps | Get-Member
ps | Get-Member
Line 21: Line 22:
Get-Alias # alias: alias, gal
Get-Alias # alias: alias, gal
Get-Member # alias: gm
Get-Member # alias: gm
New-Item # alias: ni, md, mkdir
Remove-Item # alias: del, erase, rd, ri, rm, rmdir
</source>
</source>



Revision as of 11:45, 22 February 2022

Links

Reference

# Documentation
Update-Help              # Update help system - to run as Administrator
help Test-Path           # Get help on a command, on an alias...
help Test-Path -full     # ... and on all options
help Test-Path -examples # ... see examples. VERY USEFUL

Get-Command about_*      # DOES NOT WORK
Get-Command -Verb Add
Get-Alias ps             # ... Get-Process
Get-Alias -Definition Get-Process # ... ps
ps | Get-Member

# Frequent aliases
Get-Command          # alias: gcm
Get-Process          # alias: ps
Get-Help             # alias: help
Get-Alias            # alias: alias, gal
Get-Member           # alias: gm
New-Item             # alias: ni, md, mkdir
Remove-Item          # alias: del, erase, rd, ri, rm, rmdir

Tips

Measure execution time of a command

Measure-Command { dir }
Measure-Command { dir | Out-default}   # To get output
Measure-Command { choco list }