-
Has anyone had problems when shelling out to a command prompt, the prompt just won't appear?! If you re-boot and re-run at that point it works!
Second time round it then got half way through the BCP batch file it was running and then hung with the same results then as before, not being able to open a command prompt. There was plenty of memory left and the batch file itself works!
Has anyone got any ideas???!
-
Solution
Have you tried using the API Call ShellExecute,
create a form (called frmMain) and a textbox(txtFilePath) and commandbutton(cmdRun). Then paste the code below into the form code.
Enter the path of the file you want to run and click the commandbutton. This will run the file with its associated program. (command.com or cmd.exe)
To run a file use the following code:
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 Sub cmdRun_Click()
Dim ReturnVal as Long
ReturnVal = ShellExecute(frmMain.Hwnd, "open", txtFilePath.Text, "", "", 1)
End Sub