• Advertisement
Sign in to follow this  

[.net] How to retrieve the short path form of a directory?

This topic is 4903 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Not quite sure what you mean by short path, but take a look at System.IO.FileSystem. It contains a number of methods to do path manipulation.

Share this post


Link to post
Share on other sites
An example of long path is:

C:\Program Files

The short path equivalent is:

C:\Progra~1

It's the path name, constricted to 8 characters per directory, and with no spaces or other special chars.

I need it because one of the dll's I'm using for a project at work will not accept a directory name that is in long path form.

I've already imported GetShortPathName, but would rather just have a .NET equivalent. Having my code being partial Win32 & .NET will hurt compatibility and cause other problems later on imo.

Share this post


Link to post
Share on other sites
Well, first, I'd try passing the path name to the DLL in double quotes.

If that doesn't work, you'll have to use your GetShortPathName import. I couldn't find anything related to short names in System.IO.Path or any related namespace.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement