954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

VB.NET - Running script in selected path

I currently have this piece of code:

Sub Button1Click(sender As Object, e As EventArgs)



            If dlgFolder.ShowDialog = Windows.Forms.DialogResult.OK Then

                txtPath.Text = dlgFolder.SelectedPath


                Try

                    Dim CopyFile As String = Path.Combine(Directory.GetCurrentDirectory, "pdftk.exe")
                    Dim CopyLocation As String = Path.Combine(dlgFolder.SelectedPath, "pdftk.exe")
                    Dim pyScript As String = Path.Combine(Directory.GetCurrentDirectory, "pdfmerge.py")
                    Dim pyLocation As String = Path.Combine(dlgFolder.SelectedPath, "pdfmerge.py")

                    System.IO.File.Copy(CopyFile, CopyLocation, True)
                    System.IO.File.Copy(pyScript, pyLocation, True)

                Catch copyError As IOException
                Console.WriteLine(copyError.Message)
                End Try         
            End If
End Sub


This copies two files in the current working directory (which will be the default install folder) to the selected path from the Fodler Dialog Browser. This works correctly.

Now what I want to do is too run "pdfmerge.py" into the selected folder path. I tried the below code but the script is still running in the current working directory.

Sub BtnNowClick(sender As Object, e As EventArgs)

        Dim myProcess As Process
        Dim processFile As String = Path.Combine(dlgFolder.SelectedPath, "pdfmerge.py")

        myProcess.Start(processFile, dlgFolder.SelectedPath)



    End Sub


Any help please?

blivori
Newbie Poster
12 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

Does this work?

My.Computer.FileSystem.CurrentDirectory = dlgFolder.SelectedPath
Reverend Jim
Posting Shark
Moderator
1,169 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: