问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/7386165/how-to-obtain-server-mappath-formatted-with-short-names-8-3-ms-dos-format