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 GetShortFileNam e and similar functions available in VB6.
Then I can pass the correct file path to pdftotext.exe.
Thanks in advance
Allen
Private Function funConvertPDF(B yVal 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\Tra velSystem\Trave lRequest.pdf
Dim cmd$ = fFile & " " & Path.GetDirecto ryName(fFile) & "\Temp.txt"
Try
myProcess.Enabl eRaisingEvents = True
myProcess = Process.Start(" D:\pdftotext.ex e", cmd$)
'do not procede until the converion is complete.
myProcess.WaitF orExit()
'Close the process
myProcess.Close ()
funConvertPDF = Path.GetDirecto ryName(fFile) & "\Temp.txt"
Catch a As Exception
Console.WriteLi ne(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 GetShortFileNam e and similar functions available in VB6.
Then I can pass the correct file path to pdftotext.exe.
Thanks in advance
Allen
Private Function funConvertPDF(B yVal 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\Tra velSystem\Trave lRequest.pdf
Dim cmd$ = fFile & " " & Path.GetDirecto ryName(fFile) & "\Temp.txt"
Try
myProcess.Enabl eRaisingEvents = True
myProcess = Process.Start(" D:\pdftotext.ex e", cmd$)
'do not procede until the converion is complete.
myProcess.WaitF orExit()
'Close the process
myProcess.Close ()
funConvertPDF = Path.GetDirecto ryName(fFile) & "\Temp.txt"
Catch a As Exception
Console.WriteLi ne(a.Message)
Finally
End Try
End Function
Comment