mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-03-28 21:16:20 +01:00
windows/*: add PowerShell commands and aliases (#11227)
* windows/*: add PowerShell commands and aliases * clear-host, new-item, remove-item: fix style * psversiontable, remove-item: fix style --------- Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
This commit is contained in:
parent
153b670288
commit
bcdc05b986
19 changed files with 235 additions and 3 deletions
9
pages/windows/clear-host.md
Normal file
9
pages/windows/clear-host.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Clear-Host
|
||||
|
||||
> Clears the screen.
|
||||
> This command can only be used through PowerShell.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/clear-host>.
|
||||
|
||||
- Clear the screen:
|
||||
|
||||
`cls`
|
17
pages/windows/clear-recyclebin.md
Normal file
17
pages/windows/clear-recyclebin.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Clear-RecycleBin
|
||||
|
||||
> Clear items from the Recycle Bin.
|
||||
> This command can only be used through PowerShell versions 5.1 and below, or 7.1 and above.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/clear-recyclebin>.
|
||||
|
||||
- Clear and delete all items inside the Recycle Bin:
|
||||
|
||||
`Clear-RecycleBin`
|
||||
|
||||
- Clear the Recycle Bin for a specific drive:
|
||||
|
||||
`Clear-RecycleBin -DriveLetter {{C}}`
|
||||
|
||||
- Clear the Recycle Bin without further confirmation:
|
||||
|
||||
`Clear-RecycleBin -Force`
|
7
pages/windows/clear.md
Normal file
7
pages/windows/clear.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# clear
|
||||
|
||||
> In PowerShell, this command is an alias of `Clear-Host`.
|
||||
|
||||
- View documentation for the original command:
|
||||
|
||||
`tldr clear-host`
|
|
@ -1,8 +1,13 @@
|
|||
# cls
|
||||
|
||||
> Clears the screen.
|
||||
> In PowerShell, this command is an alias of `Clear-Host`. This documentation is based on the Command Prompt (`cmd`) version of `cls`.
|
||||
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/cls>.
|
||||
|
||||
- View the documentation of the equivalent PowerShell command:
|
||||
|
||||
`tldr clear-host`
|
||||
|
||||
- Clear the screen:
|
||||
|
||||
`cls`
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# curl
|
||||
|
||||
> In PowerShell, this command may be an alias of `Invoke-WebRequest` when the original `curl` program (<https://curl.se>) is not properly installed.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest>.
|
||||
|
||||
- Check whether `curl` is properly installed by printing its version number. If this command evaluates into an error, PowerShell may have substituted this command with `Invoke-WebRequest`:
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
# del
|
||||
|
||||
> Delete one or more files.
|
||||
> In PowerShell, this command is an alias of `Remove-Item`. This documentation is based on the Command Prompt (`cmd`) version of `del`.
|
||||
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/del>.
|
||||
|
||||
- View the documentation of the equivalent PowerShell command:
|
||||
|
||||
`tldr remove-item`
|
||||
|
||||
- Delete one or more space-separated files or patterns:
|
||||
|
||||
`del {{file_pattern}}`
|
||||
|
|
8
pages/windows/gal.md
Normal file
8
pages/windows/gal.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# gal
|
||||
|
||||
> In PowerShell, this command is an alias of `Get-Alias`.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-alias>.
|
||||
|
||||
- View documentation for the original command:
|
||||
|
||||
`tldr get-alias`
|
21
pages/windows/get-alias.md
Normal file
21
pages/windows/get-alias.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Get-Alias
|
||||
|
||||
> List and get command aliases in the current PowerShell session.
|
||||
> This command can only be run under PowerShell.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-alias>.
|
||||
|
||||
- List all aliases in the current session:
|
||||
|
||||
`Get-Alias`
|
||||
|
||||
- Get the aliased command name:
|
||||
|
||||
`Get-Alias {{command_alias}}`
|
||||
|
||||
- List all aliases assigned to a specific command:
|
||||
|
||||
`Get-Alias -Definition {{command}}`
|
||||
|
||||
- List aliases that begins with `abc`, excluding those which ends at `def`:
|
||||
|
||||
`Get-Alias {{abc}}* -Exclude *{{def}}`
|
37
pages/windows/get-help.md
Normal file
37
pages/windows/get-help.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Get-Help
|
||||
|
||||
> Display help information and documentation for PowerShell commands, aka. cmdlets.
|
||||
> This command can only be run through PowerShell.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/get-help>.
|
||||
|
||||
- Display general help information for a specific cmdlet:
|
||||
|
||||
`Get-Help {{cmdlet}}`
|
||||
|
||||
- Display a more detailed documentation for a specific cmdlet:
|
||||
|
||||
`Get-Help {{cmdlet}} -Detailed`
|
||||
|
||||
- Display the full technical documentation for a specific cmdlet:
|
||||
|
||||
`Get-Help {{cmdlet}} -Full`
|
||||
|
||||
- Print only the documentation for a specific parameter of the cmdlet (use `*` to show all parameters), if available:
|
||||
|
||||
`Get-Help {{cmdlet}} -Parameter {{parameter}}`
|
||||
|
||||
- Print only the examples of the cmdlet, if available:
|
||||
|
||||
`Get-Help {{cmdlet}} -Examples`
|
||||
|
||||
- List all available cmdlet help pages:
|
||||
|
||||
`Get-Help *`
|
||||
|
||||
- Update the current help and documentation knowledge base using `Update-Help`:
|
||||
|
||||
`Update-Help`
|
||||
|
||||
- View an online version of cmdlet documentation in the default web browser:
|
||||
|
||||
`Get-Help {{cmdlet}} -Online`
|
|
@ -1,6 +1,7 @@
|
|||
# iwr
|
||||
|
||||
> This command is an alias of `Invoke-WebRequest` in PowerShell.
|
||||
> In PowerShell, this command is an alias of `Invoke-WebRequest`.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest>.
|
||||
|
||||
- View documentation for the original command:
|
||||
|
||||
|
|
33
pages/windows/new-item.md
Normal file
33
pages/windows/new-item.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# New-Item
|
||||
|
||||
> Create a new file, directory, symbolic link, or a registry entry.
|
||||
> This command can only be used through PowerShell.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/new-item>.
|
||||
|
||||
- Create a new blank file (equivalent to `touch`):
|
||||
|
||||
`New-Item {{path\to\file}}`
|
||||
|
||||
- Create a new directory:
|
||||
|
||||
`New-Item -ItemType Directory {{path\to\directory}}`
|
||||
|
||||
- Write a new text file with specified content:
|
||||
|
||||
`New-Item {{path\to\file}} -Value {{content}}`
|
||||
|
||||
- Write the same text file in multiple locations:
|
||||
|
||||
`New-Item {{path\to\file1 , path\to\file2 , ...}} -Value {{content}}`
|
||||
|
||||
- Create a symbolic link\hard link\junction to a file or directory:
|
||||
|
||||
`New-Item -ItemType {{SymbolicLink|HardLink|Junction}} -Path {{path\to\link_file}} -Target {{path\to\source_file_or_directory}}`
|
||||
|
||||
- Create a new blank registry entry (in REG_SZ, use `New-ItemProperty` or `Set-ItemProperty` to fine-tune the value type):
|
||||
|
||||
`New-Item {{path\to\registry_key}}`
|
||||
|
||||
- Create a new blank registry entry with specified value:
|
||||
|
||||
`New-Item {{path\to\registry_key}} -Value {{value}}`
|
8
pages/windows/ni.md
Normal file
8
pages/windows/ni.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# ni
|
||||
|
||||
> In PowerShell, this command is an alias of `New-Item`.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/new-item>.
|
||||
|
||||
- View documentation for the original command:
|
||||
|
||||
`tldr new-item`
|
25
pages/windows/psversiontable.md
Normal file
25
pages/windows/psversiontable.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# PSVersionTable
|
||||
|
||||
> A read-only variable (as `$PSVersionTable`) to get the current PowerShell version.
|
||||
> This command can only be run under PowerShell.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables#psversiontable>.
|
||||
|
||||
- Print a summary of the currently installed PowerShell version and edition:
|
||||
|
||||
`$PSVersionTable`
|
||||
|
||||
- Get the detailed (major, minor, build, and revision) version number of PowerShell:
|
||||
|
||||
`$PSVersionTable.PSVersion`
|
||||
|
||||
- Get a list of supported PowerShell script versions that this PowerShell version supports:
|
||||
|
||||
`$PSVersionTable.PSCompatibleVersions`
|
||||
|
||||
- Get the latest Git commit ID where the currently-installed PowerShell version is based on (works on PowerShell 6.0 and later):
|
||||
|
||||
`$PSVersionTable.GitCommitId`
|
||||
|
||||
- Check whether the user is running PowerShell Core (6.0 or later) or the original "Windows PowerShell" (version 5.1 or below):
|
||||
|
||||
`$PSVersionTable.PSEdition`
|
|
@ -1,8 +1,12 @@
|
|||
# rd
|
||||
|
||||
> This command is an alias of `rmdir`.
|
||||
> This command is an alias of `rmdir` on Command Prompt, and subsequently `Remove-Item` in PowerShell.
|
||||
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/rd>.
|
||||
|
||||
- View documentation for the original command:
|
||||
- View documentation for the original Command Prompt command:
|
||||
|
||||
`tldr rmdir`
|
||||
|
||||
- View documentation for the original PowerShell command:
|
||||
|
||||
`tldr remove-item`
|
||||
|
|
29
pages/windows/remove-item.md
Normal file
29
pages/windows/remove-item.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Remove-Item
|
||||
|
||||
> Delete files, folders, as well as registry keys and subkeys.
|
||||
> This command can only be run through PowerShell.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-item>.
|
||||
|
||||
- Remove specific files or registry keys (without subkeys):
|
||||
|
||||
`Remove-Item {{path\to\file_or_key1 path\to\file_or_key2 ...}}`
|
||||
|
||||
- Remove hidden or read-only files:
|
||||
|
||||
`Remove-Item -Force {{path\to\file1 path\to\file2 ...}}`
|
||||
|
||||
- Remove specific files or registry keys interactively prompting before each removal:
|
||||
|
||||
`Remove-Item -Confirm {{path\to\file_or_key1 path\to\file_or_key2 ...}}`
|
||||
|
||||
- Remove specific files and directories recursively (Windows 10 version 1909 or later):
|
||||
|
||||
`Remove-Item -Recurse {{path\to\file_or_directory1 path\to\file_or_directory2 ...}}`
|
||||
|
||||
- Remove specific Windows registry keys and all its subkeys:
|
||||
|
||||
`Remove-Item -Recurse {{path\to\key1 path\to\key2 ...}}`
|
||||
|
||||
- Perform a dry run of the deletion process:
|
||||
|
||||
`Remove-Item -WhatIf {{path\to\file1 path\to\file2 ...}}`
|
8
pages/windows/ri.md
Normal file
8
pages/windows/ri.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# ri
|
||||
|
||||
> In PowerShell, this command is an alias of `Remove-Item`.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-item>.
|
||||
|
||||
- View documentation for the original command:
|
||||
|
||||
`tldr remove-item`
|
8
pages/windows/rm.md
Normal file
8
pages/windows/rm.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# rm
|
||||
|
||||
> In PowerShell, this command is an alias of `Remove-Item`.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-item>.
|
||||
|
||||
- View documentation for the original command:
|
||||
|
||||
`tldr remove-item`
|
|
@ -1,8 +1,13 @@
|
|||
# rmdir
|
||||
|
||||
> Remove a directory and its contents.
|
||||
> In PowerShell, this command is an alias of `Remove-Item`. This documentation is based on the Command Prompt (`cmd`) version of `rmdir`.
|
||||
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/rmdir>.
|
||||
|
||||
- View the documentation of the equivalent PowerShell command:
|
||||
|
||||
`tldr remove-item`
|
||||
|
||||
- Remove an empty directory:
|
||||
|
||||
`rmdir {{path\to\directory}}`
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# wget
|
||||
|
||||
> In PowerShell, this command may be an alias of `Invoke-WebRequest` when the original `wget` program (<https://www.gnu.org/software/wget>) is not properly installed.
|
||||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest>.
|
||||
|
||||
- Check whether `wget` is properly installed by printing its version number. If this command evaluates into an error, PowerShell may have substituted this command with `Invoke-WebRequest`:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue