Copy-Item/Get-ChildItem Limitations

Good Evening,

I have started using robocopy.exe within my powershell scripts to get around the path limitation of Copy-Item and Get-ChildItem. I find it strange that even in Powershell v5 this issue still exists. I realise it is a limitation within Windows (for backward compatibility with older file systems) but I am certain there are ways to get around this - I think I read the win32 API can be used with prefixing the path with ‘\?’ to get around this. I just wondered why the devs of Powershell haven’t adopted this method - is there a technical reason that anyone is aware of?

Thanks.

It’s not a limitation of Windows per say, it’s a limitation of the .Net Framework which PowerShell is built on top of. Currently .Net does not support paths over 256 characters.