PJS123
asked on
Visual Basic Shell Command
I want to use a Shell command in my VB 6.0 application to start an executable. I want to pass it four parameters. Is this possible and if so, how would I do it?
Shell "c:\yourexe.exe"
What exactly do you mean with parameters ?
Like Shell "Yourexe.exe /p=blahblah"
Like Shell "Yourexe.exe /p=blahblah"
It's exactly the same way you would pass it parameters in the run dialog.
e.g. To open Windows Media Player with a file you would type:
wmplayer.exe C:/File.wav
into a run dialog box (the '.exe' is not necessary)
In VB6 you do the same thing:
Call Shell("wmplayer.exe C:/File.wav")
Hope that helps.
Sinister Shadow
e.g. To open Windows Media Player with a file you would type:
wmplayer.exe C:/File.wav
into a run dialog box (the '.exe' is not necessary)
In VB6 you do the same thing:
Call Shell("wmplayer.exe C:/File.wav")
Hope that helps.
Sinister Shadow
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
optionally, you could use ShellExecute API:
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
Sub LaunchExe()
shellexceute 0,"open","c:\myfile.exe"," parameters goes here",vbnullstring,vbnorma l
end sub
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
Sub LaunchExe()
shellexceute 0,"open","c:\myfile.exe","
end sub
or
Sub LaunchExe(sExePath as string)
shellexecute 0,"open",sExePath,"paramet ers goes here",vbnullstring,vbnorma l
end sub
Sub LaunchExe(sExePath as string)
shellexecute 0,"open",sExePath,"paramet
end sub
Hi PJS123,
This old question (QID 20555209) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
This old question (QID 20555209) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
-->Accept trkcorp's comments as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
GPrentice00
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
-->Accept trkcorp's comments as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
GPrentice00
EE Cleanup Volunteer