2

I am using Process.Start to run a console application on the ASP.NET server and the parameters of the program need a path that is formatted in the old MS-DOS 8.3 format.

For example in a console name of the folders in this format can be obtained by typing "dir /X":

How can I obtain Server.MapPath() formatted with the short names version(8.3 MS-DOS format) of the folder names?

Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169

1 Answers1

3

This is not available as managed API...

You will need to use P/Invoke and call GetShortPathName on the result of Server.MapPath() and it will only succed if the result of Server.MapPath() really exists... see http://pinvoke.net/default.aspx/kernel32.GetShortPathName and http://msdn.microsoft.com/en-us/library/aa364989%28v=vs.85%29.aspx

Yahia
  • 69,653
  • 9
  • 115
  • 144