powershell

Test-Path doesn't found localised folder names


I'm currently working in an environment with the culture set to "$PSCulture de-DE". When I execute the command:

Test-Path 'C:\Users'

it returns True. However, in Windows Explorer, I see 'Benutzer' instead of 'Users'. When I run the command:

Test-Path 'C:\Benutzer'

it returns False.

How can I tell PowerShell to recognize localized folder names?


Solution

  • The localized folder names are just for display, they are not an actual path. Thus, C:\Benutzer does not exist as path. Explorer looks up the Desktop.ini file in folders for customization such as localized folder names and special icons.

    So you would have to traverse all folders and look up the Desktop.ini file to find out whether the given name was a localized name, and it would still not exist as actual path.