Skip to content

Commit 83e64a3

Browse files
(AB-538640) Clarify behavior of Rename-Item when new name item exists
1 parent 4dde946 commit 83e64a3

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

reference/5.1/Microsoft.PowerShell.Management/Rename-Item.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 01/18/2026
5+
ms.date: 04/01/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/rename-item?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -40,6 +40,10 @@ content of the item being renamed.
4040
You can't use `Rename-Item` to move an item, such as by specifying a path together with the new
4141
name. To move and rename an item, use the `Move-Item` cmdlet.
4242

43+
You can't use `Rename-Item` to replace an existing item, such as renaming `log_new.txt` to
44+
`log_current.txt` when `log_current.txt` already exists. To replace an existing item, use the
45+
`Move-Item` cmdlet with the **Force** parameter.
46+
4347
## EXAMPLES
4448

4549
### Example 1: Rename a file
@@ -152,7 +156,8 @@ or read-only aliases or variables. The cmdlet can't change constant aliases or v
152156
Implementation varies from provider to provider. For more information, see
153157
[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md).
154158
155-
Even using the **Force** parameter, the cmdlet can't override security restrictions.
159+
Even using the **Force** parameter, the cmdlet can't override security restrictions or replace an
160+
existing item at the destination name specified by **NewName**.
156161
157162
```yaml
158163
Type: System.Management.Automation.SwitchParameter

reference/7.4/Microsoft.PowerShell.Management/Rename-Item.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 01/18/2026
5+
ms.date: 04/01/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/rename-item?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -39,6 +39,10 @@ content of the item being renamed.
3939
You can't use `Rename-Item` to move an item, such as by specifying a path together with the new
4040
name. To move and rename an item, use the `Move-Item` cmdlet.
4141

42+
You can't use `Rename-Item` to replace an existing item, such as renaming `log_new.txt` to
43+
`log_current.txt` when `log_current.txt` already exists. To replace an existing item, use the
44+
`Move-Item` cmdlet with the **Force** parameter.
45+
4246
## EXAMPLES
4347

4448
### Example 1: Rename a file
@@ -151,7 +155,8 @@ or read-only aliases or variables. The cmdlet can't change constant aliases or v
151155
Implementation varies from provider to provider. For more information, see
152156
[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md).
153157
154-
Even using the **Force** parameter, the cmdlet can't override security restrictions.
158+
Even using the **Force** parameter, the cmdlet can't override security restrictions or replace an
159+
existing item at the destination name specified by **NewName**.
155160
156161
```yaml
157162
Type: System.Management.Automation.SwitchParameter

reference/7.5/Microsoft.PowerShell.Management/Rename-Item.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 01/18/2026
5+
ms.date: 04/01/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/rename-item?view=powershell-7.5&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -39,6 +39,10 @@ content of the item being renamed.
3939
You can't use `Rename-Item` to move an item, such as by specifying a path together with the new
4040
name. To move and rename an item, use the `Move-Item` cmdlet.
4141

42+
You can't use `Rename-Item` to replace an existing item, such as renaming `log_new.txt` to
43+
`log_current.txt` when `log_current.txt` already exists. To replace an existing item, use the
44+
`Move-Item` cmdlet with the **Force** parameter.
45+
4246
## EXAMPLES
4347

4448
### Example 1: Rename a file
@@ -151,7 +155,8 @@ or read-only aliases or variables. The cmdlet can't change constant aliases or v
151155
Implementation varies from provider to provider. For more information, see
152156
[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md).
153157
154-
Even using the **Force** parameter, the cmdlet can't override security restrictions.
158+
Even using the **Force** parameter, the cmdlet can't override security restrictions or replace an
159+
existing item at the destination name specified by **NewName**.
155160
156161
```yaml
157162
Type: System.Management.Automation.SwitchParameter

reference/7.6/Microsoft.PowerShell.Management/Rename-Item.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 01/18/2026
5+
ms.date: 04/01/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/rename-item?view=powershell-7.6&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -39,6 +39,10 @@ content of the item being renamed.
3939
You can't use `Rename-Item` to move an item, such as by specifying a path together with the new
4040
name. To move and rename an item, use the `Move-Item` cmdlet.
4141

42+
You can't use `Rename-Item` to replace an existing item, such as renaming `log_new.txt` to
43+
`log_current.txt` when `log_current.txt` already exists. To replace an existing item, use the
44+
`Move-Item` cmdlet with the **Force** parameter.
45+
4246
## EXAMPLES
4347

4448
### Example 1: Rename a file
@@ -151,7 +155,8 @@ or read-only aliases or variables. The cmdlet can't change constant aliases or v
151155
Implementation varies from provider to provider. For more information, see
152156
[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md).
153157
154-
Even using the **Force** parameter, the cmdlet can't override security restrictions.
158+
Even using the **Force** parameter, the cmdlet can't override security restrictions or replace an
159+
existing item at the destination name specified by **NewName**.
155160
156161
```yaml
157162
Type: System.Management.Automation.SwitchParameter

0 commit comments

Comments
 (0)