Dear
How can i call batch file from VB when program is run ?
Best Regards
Long
Printable View
Dear
How can i call batch file from VB when program is run ?
Best Regards
Long
In the Form's Load Event
Shell("location of a batch file")
That what u want??
I've try but sometimes failed !!!
Someone can help me ?
Best Regards
Long
syntax is
shell "program name", state.
where state is vbhidden, vb maximised etc.
try this
VB Code:
Public 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 command1_click() Call ShellExecute(hwnd, "Open", pathtobatchfile, "", App.Path, 1) end sub
I've try but sometimes failed !!!
Someone can help me ?
Best Regards
Long
Maybe you should post your app/ or your code so that we can have a look.
This is my sample program
Private sub Command1_Click()
Shell ( "C:\Connect.Bat")
form2.show
end sub
Private Sub Form_Unload()
shell ("C:\Disconnect.Bat")
end sub
in Do.Bat i put some coding to connect from one server with another server at difference place.
If i run my batch file from dos it's work.
Best Regards
Long
Well I don't know much about Batch Files but, maybe theres something wrong with them instead??
my coding in batch file such :
net use \\testing\ipc$ /user:dm_tester\name pass