A
Allen
Greetings,
I need to pass a file path to an application. This file path contains long
directory and file names. The target application, pdftotext.exe, only
accepts short directory and file names. Is there an equivalent VB.NET
function to the GetShortFileName and similar functions available in VB6.
Then I can pass the correct file path to pdftotext.exe.
Thanks in advance
Allen
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
I need to pass a file path to an application. This file path contains long
directory and file names. The target application, pdftotext.exe, only
accepts short directory and file names. Is there an equivalent VB.NET
function to the GetShortFileName and similar functions available in VB6.
Then I can pass the correct file path to pdftotext.exe.
Thanks in advance
Allen
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