# New .NET path handling sneak peek

As mentioned I'm going to do the On .NET show in a couple weeks to talk about path changes in .NET. In the meantime, a little bit of fun for you if you've got the latest (14361) fast ring build for Windows 10 Anniversary Update...

UPDATE: In the latest drop (14367) PowerShell opts into the new behaviors- the following config file isn't necessary.

Drop a file called powershell.exe.config in C:\Windows\System32\WindowsPowerShell\v1.0 with the following contents to opt in to one of the new 4.6.2 features (as PS doesn't target 4.6.2):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false" />
</runtime>
</configuration>


Now start up PowerShell and create yourself a C:\foo directory so you can try a few things.

Make yourself a foo file:
PS C:\foo> echo footext > foo

And a bar file:
PS C:\foo> echo bartext > bar

Copy foo to bar:foo:
PS C:\foo> copy foo \\?\C:\foo\bar:foo

Take a look at what we've got:
PS C:\foo> dir \\?\C:\foo

Now take a closer look:
PS C:\foo> type bar
PS C:\foo> type -LiteralPath \\?\C:\foo\bar:foo
I'll leave it to you to play around a bit more with this. Look at my prior posts on path handling to clarify what is going on here and try and give me some of your own cool examples of what you can do. 🙂

Tags