myProcess.WaitForExit() ''关闭流程 myProcess.Close() funConvertPDF = Path.GetDirectoryName(fFile)& " \ Temp.txt" 抓住一个例外 Console.WriteLine(a.Message) 最后 结束尝试 结束功能 Greetings,I need to pass a file path to an application. This file path contains longdirectory and file names. The target application, pdftotext.exe, onlyaccepts short directory and file names. Is there an equivalent VB.NETfunction to the GetShortFileName and similar functions available in VB6.Then I can pass the correct file path to pdftotext.exe. Thanks in advanceAllen Private Function funConvertPDF(ByVal fFile$) As String ''Create a new process Dim myProcess As New Process ''This will break if cmd$ contains long file name. for example if fFile$ ="d:\Library\TravelSystem\TravelRequest.pdf Dim cmd$ = fFile & " " & Path.GetDirectoryName(fFile) & "\Temp.txt" Try myProcess.EnableRaisingEvents = True myProcess = Process.Start("D:\pdftotext.exe", cmd$) ''do not procede until the converion is complete. myProcess.WaitForExit() ''Close the process myProcess.Close() funConvertPDF = Path.GetDirectoryName(fFile) & "\Temp.txt" Catch a As Exception Console.WriteLine(a.Message) Finally End Try End Function 推荐答案 )作为字符串 ''创建一个新流程 将myProcess视为新流程 ''如果cmd ) As String ''Create a new process Dim myProcess As New Process ''This will break if cmd 包含长文件名,则会中断。例如,如果fFile contains long file name. for example if fFile = " d:\ Libree \ TravelSystem\TravelRequest.pdf Dim cmd ="d:\Library\TravelSystem\TravelRequest.pdf Dim cmd 这篇关于VB.NET GetShortFileName等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-14 00:29