mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-12 15:47:47 +00:00
32 lines
854 B
Plaintext
32 lines
854 B
Plaintext
---
|
||
syntax: markdown
|
||
tags: [tldr, windows]
|
||
source: https://github.com/tldr-pages/tldr.git
|
||
---
|
||
# Rename-Item
|
||
|
||
> Powershell command to rename an item.
|
||
> Note: `ren` and `rni` can both be used as an alias for `Rename-Item`.
|
||
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/rename-item>.
|
||
|
||
- Rename a file:
|
||
|
||
`Rename-Item -Path "{{path oile}}" -NewName "{{new_file_name}}"`
|
||
|
||
- Rename a directory:
|
||
|
||
`Rename-Item -Path "{{path o\directory}}" -NewName "{{new_directory_name}}"`
|
||
|
||
- Rename and move a file:
|
||
|
||
`Rename-Item -Path "{{path oile}}" -NewName "{{path o
|
||
ew_file_name}}"`
|
||
|
||
- Rename a file by force:
|
||
|
||
`Rename-Item -Path "{{path oile}}" -NewName "{{new_file_name}}" -Force`
|
||
|
||
- Prompt confirmation before renaming a file:
|
||
|
||
`Rename-Item -Path "{{path oile}}" -NewName "{{new_file_name}}" {{[-Confirm|-cf]}}`
|