English 中文(简体)
我如何解决Windows的传闻名?
原标题:How do I resolve a canonical filename in Windows?

如果我有这种决心在Windows上立案,是否有一种可接受的途径来获得档案名称的传说形式?

例如,我很想知道,我是否知道。

C:stuff	hingsetcmiscwhatever.txt

以及

C:stuff	hingsetcmiscother..whatever.txt

actually point to the same file or not, 以及store the canonical form of the path in my application.

Note that simple string comparisons won t work, nor will any RegEx magic. Remember that we have things like NTFS reparse points to deal with since Windows 2000 以及the new Libraries structure in Windows 7.

最佳回答

答案:不是真实的。

在视窗上查阅档案的传闻没有简单的方法。 当地档案可以通过SUBST通过再版站提供。 你们是否希望处理国家食品安全局的禁令? Windows 捷径? 什么是<代码/>?-efalld filename

可通过地图驱动信或UNC提供远距离档案。 联合国贸易法委员会是不是该来源服务器? 你们是否使用家庭调查? 服务器是否使用备用点等? 服务器是否有不止一个名称? IP地址是什么? 它是否有不止一个IP地址?

因此,如果你重新寻找像视窗上的登位数这样的东西,就会出现这种情况。 See, for example, this page

问题回答

http://msdn.microsoft.com/en-us/library/windows/desktop/a364962.aspx“rel=” GetFinalPathNameByHandle 看来是你要求做的事,从Windowsista开始。

使用FileInfo(见C#):

FileInfo info1 = new FileInfo(@"C:stuff	hingsetcmiscwhatever.txt");
FileInfo info2 = new FileInfo(@"C:stuff	hingsetcmiscother..whatever.txt");
if (info1.FullName.Equals(info2.FullName)) {
    Console.WriteLine("yep, they re equal");
}
Console.WriteLine(info1.FullName);
Console.WriteLine(info2.FullName);

产出是:

yep, they re equal
C:stuff hingsetcmiscwhatever.txt
C:stuff hingsetcmiscwhatever.txt

j. 婚礼有一点答案,但由于你没有表明你使用哪一种语言,我觉得我给他一种 Python的路,也使用:

> python -c "import os.path; print os.path.abspath( C:stuff	hingsetcmiscother..whatever.txt )"
C:stuff	hingsetcmiscwhatever.txt

我将使用该系统。 它是一种投入(C:在你的案件中,窒息了 h,并且将产生一种扼杀(C:stuff hingsetcmiscwhatever.txt)。

我猜想过一点迟,但你可以使用“C.IO.Path.GetFullPath”(“C:stuff hingsetcmiscother.whatever.txt”),并将返回“C:stuff hingsetcmiscwhatever.txt”





相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签