标准的方式来转换为.NET短路径转换为、路径、方式、标准

2023-09-03 01:07:58 作者:Passerby 过路人

寻找标准错误,校对的方式转换成长名称,如C:\ Documents和设置为等效的短名称C:\ DOCUME〜1

looking for the standard bug-proofed way to convert "long names" such as "C:\Documents and settings" to their equivalent "short names" "C:\DOCUME~1"

我需要这个从withing我的C#应用​​程序运行外部程序。它失败,如果我给它用在长名称的路径。

I need this to run an external process from withing my C# app. It fails if I feed it with paths in the "long name".

推荐答案

请问,即使你用引号将长文件路径的外部进程失败?这可能是一个简单的方法,如果外部应用程序支持它。

Does the external process fail even if you enclose the long file paths in quotes? That may be a simpler method, if the external app supports it.

例如。

myExternalApp "C:\Documents And Settings\myUser\SomeData.file"
 
精彩推荐