Browse Source

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
Reinhart Previano Koentjoro 1 year ago
parent
commit
ab8e6f24c4

+ 9 - 0
pages/windows/get-location.md

@@ -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 - 0
pages/windows/gl.md

@@ -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 - 0
pages/windows/mi.md

@@ -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`

+ 37 - 0
pages/windows/move-item.md

@@ -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 - 0
pages/windows/move.md

@@ -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 - 0
pages/windows/mv.md

@@ -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 - 0
pages/windows/pwd.md

@@ -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`