Sign in to follow this  

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

This topic is 4834 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

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

This topic is 4834 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this