windows/*: add PowerShell pwd and mv equivalents (#11342)

* windows/*: add PowerShell pwd and mv equivalents

* move-item: simplify examples

* move-item: fix typo

* get-location, move-item: add PowerShell-only notice
pull/23/head
Reinhart Previano Koentjoro 2023-11-01 08:29:01 +07:00 committed by GitHub
parent f1673431e1
commit ab8e6f24c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,9 @@
# Get-Location
> Print name of current/working directory.
> This command can only be run through PowerShell.
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-location>.
- Print the current directory:
`Get-Location`

8
pages/windows/gl.md Normal file
View File

@ -0,0 +1,8 @@
# gl
> In PowerShell, this command is an alias of `Get-Location`.
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-location>.
- View documentation for the original command:
`tldr get-location`

8
pages/windows/mi.md Normal file
View File

@ -0,0 +1,8 @@
# mi
> In PowerShell, this command is an alias of `Move-Item`.
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/move-item>.
- View documentation for the original command:
`tldr move-item`

View File

@ -0,0 +1,37 @@
# Move-Item
> Move or rename files, directories, registry keys, and other PowerShell data items.
> This command can only be run through PowerShell.
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/move-item>.
- Rename a file or directory when the target is not an existing directory:
`Move-Item {{path\to\source}} {{path\to\target}}`
- Move a file or directory into an existing directory:
`Move-Item {{path\to\source}} {{path\to\existing_directory}}`
- Rename or move file(s) with specific name (do not treat special characters inside strings):
`Move-Item -LiteralPath "{{path\to\source}}" {{path\to\file_or_directory}}`
- Move multiple files into an existing directory, keeping the filenames unchanged:
`Move-Item {{path\to\source1 , path\to\source2 ...}} {{path\to\existing_directory}}`
- Move or rename registry key(s):
`Move-Item {{path\to\source_key1 , path\to\source_key2 ...}} {{path\to\new_or_existing_key}}`
- Do not prompt for confirmation before overwriting existing files or registry keys:
`mv -Force {{path\to\source}} {{path\to\target}}`
- Prompt for confirmation before overwriting existing files, regardless of file permissions:
`mv -Confirm {{path\to\source}} {{path\to\target}}`
- Move files in dry-run mode, showing files and directories which could be moved without executing them:
`mv -WhatIf {{path\to\source}} {{path\to\target}}`

29
pages/windows/move.md Normal file
View File

@ -0,0 +1,29 @@
# move
> Move or rename files and directories.
> In PowerShell, this command is an alias of `Move-Item`. This documentation is based on the Command Prompt (`cmd`) version of `move`.
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/move>.
- View documentation of the equivalent PowerShell command:
`tldr move-item`
- Rename a file or directory when the target is not an existing directory:
`move {{path\to\source}} {{path\to\target}}`
- Move a file or directory into an existing directory:
`move {{path\to\source}} {{path\to\existing_directory}}`
- Move a file or directory across drives:
`move {{C:\path\to\source}} {{D:\path\to\target}}`
- Do not prompt for confirmation before overwriting existing files:
`move /Y {{path\to\source}} {{path\to\existing_directory}}`
- Prompt for confirmation before overwriting existing files, regardless of file permissions:
`move /-Y {{path\to\source}} {{path\to\existing_directory}}`

13
pages/windows/mv.md Normal file
View File

@ -0,0 +1,13 @@
# mv
> In PowerShell, this command is an alias of `Move-Item`.
> However, this command is not available on the Command Prompt (`cmd`). Use `move` instead for similar functionality.
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/move-item>.
- View documentation for the equivalent Command Prompt command:
`tldr move`
- View documentation for the original PowerShell command:
`tldr move-item`

13
pages/windows/pwd.md Normal file
View File

@ -0,0 +1,13 @@
# pwd
> In PowerShell, this command is an alias of `Get-Location`.
> However, this command is not available on the Command Prompt (`cmd`). Use `cd` instead for similar functionality.
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-location>.
- View documentation for the equivalent Command Prompt command:
`tldr cd`
- View documentation for the original PowerShell command:
`tldr get-location`