malcolm29
asked on
What version of MS Operating Systems support the long file path feature \\?\
I am trying to read in file names that have paths longer than 266 characters. So, I'm using \\?\ as a pre-pend to the file name.
This works great on my Windows 10 machine, but when I try to run it (using PowerShell v. 4) on a Windows Server 2012 R2 Datacenter machine (Windows version 6.3.9600), I get error messages leading me to assume that the feature is not supported.
Here's my actual PowerShell code to test this. Again, this works fine on my Win10 desktop, but not the server:
$sFileName = "\\?\H:\COMMUNITY\Complian ce\AQIP\20 10 Systems Portfolio\Systems Portfolio Draft orig (Autosaved).docx"
$objFileStream = New-Object IO.FileStream($sFileName,[ System.IO. FileMode]: :Open)
The error I get is:
New-Object : Exception calling ".ctor" with "2" argument(s): "Illegal characters in path."
At H:\Information Technology\InstallFilesOld \OtherPSSc ripts\Test .ps1:2 char:18
+ $objFileStream = New-Object IO.FileStream("\\?\$($sFil eName)",[S ystem.IO.F ileMod ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowExc eption,Mic rosoft.Pow erShell.Co mmands.New ObjectComm and
If I run the code without the \\?\ (using the following code), I don't get any errors.
$sFileName = "H:\COMMUNITY\Compliance\A QIP\2010 Systems Portfolio\Systems Portfolio Draft orig (Autosaved).docx"
$objFileStream = New-Object IO.FileStream($sFileName,[ System.IO. FileMode]: :Open)
This works great on my Windows 10 machine, but when I try to run it (using PowerShell v. 4) on a Windows Server 2012 R2 Datacenter machine (Windows version 6.3.9600), I get error messages leading me to assume that the feature is not supported.
Here's my actual PowerShell code to test this. Again, this works fine on my Win10 desktop, but not the server:
$sFileName = "\\?\H:\COMMUNITY\Complian
$objFileStream = New-Object IO.FileStream($sFileName,[
The error I get is:
New-Object : Exception calling ".ctor" with "2" argument(s): "Illegal characters in path."
At H:\Information Technology\InstallFilesOld
+ $objFileStream = New-Object IO.FileStream("\\?\$($sFil
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowExc
If I run the code without the \\?\ (using the following code), I don't get any errors.
$sFileName = "H:\COMMUNITY\Compliance\A
$objFileStream = New-Object IO.FileStream($sFileName,[
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help. :)
ASKER