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?

Does this work?

My.Computer.FileSystem.CurrentDirectory = dlgFolder.SelectedPath
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.