如何获取使用Server.Mappath()与短名称(8.3 MS-DOS格式)格式的? [英] How to obtain Server.MapPath() formatted with short names (8.3 MS-DOS format)?
问题描述
我使用的Process.Start运行ASP.NET的服务器和控制台应用程序的参数需要一个在旧的MS-DOS 8.3格式进行格式化的路径。
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.
例如,在这种格式的文件夹的名字控制台可以通过输入获得DIR / X:
For example in a console name of the folders in this format can be obtained by typing "dir /X":
我怎样才能获得与文件夹名称的短名称版本(8.3 MS-DOS格式)格式的使用Server.Mappath()?
How can I obtain Server.MapPath() formatted with the short names version(8.3 MS-DOS format) of the folder names?
推荐答案
这是不作为托管API ...
This is not available as managed API...
您将需要使用的P / Invoke并调用 GetShortPathName
上的结果使用Server.Mappath()
和它只会赢得成功,如果结果使用Server.Mappath()
真的存在......看的 http://pinvoke.net/default.aspx/kernel32.GetShortPathName 和的 http://msdn.microsoft.com/en-us/library/aa364989%28v=vs.85%29.aspx
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
这篇关于如何获取使用Server.Mappath()与短名称(8.3 MS-DOS格式)格式的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!