PowerShell: Remove-Item fails on FAT32 drive when encountering some Unicode characters
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Consider the data in RADWIMPS.zip (note: this is copyrighted material I rip-ped from a CD I legally own; please don’t redistribute).
When this is found on a FAT32 drive, you cannot delete the file tree using Remove-Item
:
This repro’s both in 7.2.1 and 7.3.0-preview.1.
CMD.EXE has no problem with the same data:
Expected behavior
`Remove-Item` should remove the entire directory tree.
Actual behavior
`Remove-Item` fails with `Remove-Item: No mapping for the Unicode character exists in the target multi-byte code page.`
Error details
Exception :
Type : System.ComponentModel.Win32Exception
NativeErrorCode : 1113
ErrorCode : -2147467259
TargetSite :
Name : IsReparsePointLikeSymlink
DeclaringType : Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods
MemberType : Method
Module : System.Management.Automation.dll
Message : No mapping for the Unicode character exists in the target multi-byte code page.
Source : System.Management.Automation
HResult : -2147467259
StackTrace :
at
Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods.IsReparsePointLikeSymlink(FileSystemInfo
fileInfo)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory,
Boolean recurse, Boolean force, Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory,
Boolean recurse, Boolean force, Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)
at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String
path, Boolean recurse, CmdletProviderContext context)
CategoryInfo : NotSpecified: (:) [Remove-Item], Win32Exception
FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.RemoveItemCommand
InvocationInfo :
MyCommand : Remove-Item
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 78
Line : Remove-Item -Recurse -Force -LiteralPath J:\RADWIMPS -Verbose
PositionMessage : At line:1 char:1
+ Remove-Item -Recurse -Force -LiteralPath J:\RADWIMPS -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Remove-Item
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Environment data
Name Value
---- -----
PSVersion 7.3.0-preview.1
PSEdition Core
GitCommitId 7.3.0-preview.1
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (8 by maintainers)
What about this?
PS16804.zip
Output: