startup dos program from vb6

Schuttend used Ask the Experts™

I am trying to startup an external program from vb6. However the program will not run.
I get an error mentioning that the program must start from it's own directory.
Any suggestions?
shell ("cmd /c c:\pinnacle\goweb.exe")

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try the shellexecute method :

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 
Private Const SW_SHOWNORMAL = 1
ShellExecute Me.hwnd, "open", "c:\pinnacle\goweb.exe", vbNullString, "c:\pinnacle\", SW_SHOWNORMAL 

Open in new window

create a batch file that first cd's to that directory and then starts the program.
Call the batch file from your own program.


Thanks for the fast reply!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial