CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: shell command

  1. #1
    Join Date
    Apr 2000
    Posts
    69

    shell command

    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


  2. #2
    Join Date
    Sep 2001
    Location
    Little Rock, Arkansas
    Posts
    40

    Re: shell command

    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")



  3. #3
    Join Date
    Sep 2001
    Location
    Montreal Canada
    Posts
    1,080

    Re: shell command

    Check windows api for CreateProcess... More complex to call but works better.

    Nicolas

    Nicolas Bohemier

  4. #4
    Join Date
    Sep 2001
    Location
    IL, USA
    Posts
    1,090

    Re: shell command

    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)




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured