How to obtain Server.MapPath() formatted with short names (8.3 MS-DOS format)?

左心房为你撑大大i 提交于 2019-12-22 19:42:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!