I am currently trying to call a program from VB.Net that uses some command line switches. The following is the code I am using. The problems is that I get the error: "No application is associated with the specified file for this operation."


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim wsh
wsh = CreateObject("WScript.Shell")
wsh.Run(Directory.GetCurrentDirectory + "\GetSigw.exe /3 " + Directory.GetCurrentDirectory + "\SigAVA.bmp", 0, 1)
Catch ex As Exception

End Try
End Sub

Any help would much appreciated.



Recommended Answers

All 2 Replies

Have you checked to see that directory.getcurrentdirectory is returning the proper path, or returning anything at all? Also, After some long hours of headache and painful study, Visal and I found that passing data to WSH's Run Method that contains spaces (in VB6, We Tried App.Path ) forces it to error, because it doesn't properly render the spaces. A Solution for you to look into is:

Dim myProcess As Process = System.Diagnostics.Process.Start(Directory.GetCurrentDirectory + "\GetSigw.exe /3 " + Directory.GetCurrentDirectory + "\SigAVA.bmp")

or something similar and along those lines. The WSH's Run Method is great, if you can throw in a bunch of chr(34)'s around your directory.getcurrentdirectory's, but I think this procedure will be more effective for you.

Thanks, I will try the code you gave me. Thanks a lot.


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.