Click to See Complete Forum and Search --> : shell command


Eddie Leong
September 19th, 2001, 04:58 AM
hello,

I know how to use shell command but, I don't know how to execute this "c:\abc.exe -a -b c". It is working in shortcut at desktop. when I try

shell "c:\abc.exe -a -b c"
or
hud = shell ("c:\abc.exe -a -b c")

in VB, this command behind the execute file will not passing in to the software. Could any one help?

Thank you very much

Eddie

dcaillouet
September 19th, 2001, 06:49 AM
I have not tested this solution and I don't know if it will work.

Why don't you try putting the command "c:\abc.exe -a -b c" into a file called "abc.bat". If you run this .bat file, does your program execute properly? If it does, then try:

hud = shell ("c:\abc.bat")

Boumxyz2
September 19th, 2001, 07:39 AM
Check windows api for CreateProcess... More complex to call but works better.

Nicolas

MKSa
September 19th, 2001, 08:17 PM
The Shell function works and it should pass the parameters on the command line to the executable preceding them. In the following example the file test.txt is passed to Notepad and Notepad window is displayed:
ret=Shell("Notepad.exe test.txt",vbNormalFocus)