【发布时间】:2017-11-02 08:08:45
【问题描述】:
我正在尝试读取 word 文件路径,但它在 vb.net 中返回错误的路径,我正在使用 Path.getfullpath
For Each a In p
If Not pName.Equals("") And I <= p.Count Then
Console.WriteLine(a)
Console.WriteLine(p.Count)
pName = p(I).MainWindowTitle.ToString
File.WriteLine("Word Process Name : {0} is started on time {1}", pName, p(I).StartTime)
fullPath = Path.GetFullPath(pName)
File.WriteLine("Path Of the file is : {0}", fullPath(0))
End If
Next
【问题讨论】:
-
看来你的问题主要是代码,请添加一些cmets。
-
Path.GetFullPath()不能只是神奇地查找您传递给它的任何路径。它所做的只是确保您没有相对路径,即如果您的应用程序的工作目录是C:\Program Files (x86)\yourApp,Hello.txt将变为C:\Program Files (x86)\yourApp\Hello.txt。 -
那我怎么才能跳出默认路径
-
你上面给出的链接是获取可执行文件的路径,但我想要 MainWindowsTitle 的路径