From ab8e6f24c45d594482814e7428a86fdb3704b264 Mon Sep 17 00:00:00 2001 From: Reinhart Previano Koentjoro Date: Wed, 1 Nov 2023 08:29:01 +0700 Subject: [PATCH] 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 --- pages/windows/get-location.md | 9 +++++++++ pages/windows/gl.md | 8 ++++++++ pages/windows/mi.md | 8 ++++++++ pages/windows/move-item.md | 37 +++++++++++++++++++++++++++++++++++ pages/windows/move.md | 29 +++++++++++++++++++++++++++ pages/windows/mv.md | 13 ++++++++++++ pages/windows/pwd.md | 13 ++++++++++++ 7 files changed, 117 insertions(+) create mode 100644 pages/windows/get-location.md create mode 100644 pages/windows/gl.md create mode 100644 pages/windows/mi.md create mode 100644 pages/windows/move-item.md create mode 100644 pages/windows/move.md create mode 100644 pages/windows/mv.md create mode 100644 pages/windows/pwd.md diff --git a/pages/windows/get-location.md b/pages/windows/get-location.md new file mode 100644 index 0000000000..066ec50470 --- /dev/null +++ b/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: . + +- Print the current directory: + +`Get-Location` diff --git a/pages/windows/gl.md b/pages/windows/gl.md new file mode 100644 index 0000000000..2032ef1cb7 --- /dev/null +++ b/pages/windows/gl.md @@ -0,0 +1,8 @@ +# gl + +> In PowerShell, this command is an alias of `Get-Location`. +> More information: . + +- View documentation for the original command: + +`tldr get-location` diff --git a/pages/windows/mi.md b/pages/windows/mi.md new file mode 100644 index 0000000000..8d58b4f4f4 --- /dev/null +++ b/pages/windows/mi.md @@ -0,0 +1,8 @@ +# mi + +> In PowerShell, this command is an alias of `Move-Item`. +> More information: . + +- View documentation for the original command: + +`tldr move-item` diff --git a/pages/windows/move-item.md b/pages/windows/move-item.md new file mode 100644 index 0000000000..b55f112bd6 --- /dev/null +++ b/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: . + +- 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}}` diff --git a/pages/windows/move.md b/pages/windows/move.md new file mode 100644 index 0000000000..7d480deebd --- /dev/null +++ b/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: . + +- 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}}` diff --git a/pages/windows/mv.md b/pages/windows/mv.md new file mode 100644 index 0000000000..c3d1f44ae8 --- /dev/null +++ b/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: . + +- View documentation for the equivalent Command Prompt command: + +`tldr move` + +- View documentation for the original PowerShell command: + +`tldr move-item` diff --git a/pages/windows/pwd.md b/pages/windows/pwd.md new file mode 100644 index 0000000000..2dd917806c --- /dev/null +++ b/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: . + +- View documentation for the equivalent Command Prompt command: + +`tldr cd` + +- View documentation for the original PowerShell command: + +`tldr get-location`