Long Paths (>260) and Windows Explorer-VBForums
Results 1 to 4 of 4

Thread: Long Paths (>260) and Windows Explorer

  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    2,706

    Long Paths (>260) and Windows Explorer

    Interesting, I'm just beginning to start testing some of my "Long Path" procedures. It's my understanding that Windows Explorer doesn't really like these, but that's okay. I'll work around that in my code.

    However, I was just creating a long path for testing. Interestingly, Windows Explorer started using the 8.3 naming system when the folder paths got too long.

    I don't have an easy way to turn the 8.3 off on my test system. I'm just wondering what happens if it'd been off. Here's a sample of a path that I'm now getting:

    C:\Users\Elroy\Desktop\LONGPA~1\THISIS~1\AndYetAgainWeAreCreatingAVeryLongFolderNameSoAsToCreateAPat hThatIsLongerThanTheTwoHundredAndSixtyCharacterLimit

    Notice the 8.3. That's not my doing. Windows Explorer did that all on its own.

    So, what happens if 8.3 is turned off?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    16,173

    Re: Long Paths (>260) and Windows Explorer

    Not sure you can 'turn it off'. A file can be referenced via its short or long path. In fact, there may be older drivers and applications that can't read long paths, paths/file names with spaces, etc. The short path, in that case, is the workaround. You can convert long to short via GetShortPathName API and convert from short to long via GetLongPathName.

    Additionally, passing long paths to APIs that have a max character limit can be overcome, in many cases, by preceding the path with: \\?\. Note that this usually applies to the unicode APIs but, in any case, requires reading the limitations of whatever API the path is intended for.
    Insomnia is just a byproduct of, "It can't be done"

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VB and DPI Tutorial} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,055

    Re: Long Paths (>260) and Windows Explorer

    Welcome back foxy, good to see you again.

    >Not sure you can 'turn it off'
    8.3 filename support can be disabled on recent versions of Windows via use of the fsutil.exe cmd line utility. The feature is on by default for desktop versions and (it is said) off by default in server versions. When off ShortPathName only returns the LongPathName if it complies with an 8.3 spec, otherwise it returns a blank. Ref. http://blogs.msdn.com/b/winsdk/archi...path-name.aspx

  4. #4
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,055

    Re: Long Paths (>260) and Windows Explorer

    Sorry about the dead link in my last post here it is again https://blogs.msdn.microsoft.com/win...ort-path-name/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.