CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    7

    Using the Shell function

    Im trying to use the Shell function in order to start an executable file that requires an argument (a file name). The program can only be executed from the command promt (DOS) and the argument is a file name (converts .wad files to .pcx files). It doesn't work. I can see that the progam starts the same way it does when i double klick on it in windows, that is without an argument. But it refuses to read the argument when i use Shell "C:\wad3.exe & " " & fileName, 2 . If i start it from the command promt (like: c:\wad3.exe batman.wad) it works as intended.. Any idea how to solve this problem? Is there any other function that can be used?


  2. #2
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Re: Using the Shell function

    Put the whole command line into the string, i.e



    dim myStr as string

    myStr = "C:\wad3.exe " & fileName
    Shell myStr






    That should work.

    Andrew


  3. #3
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    7

    Re: Using the Shell function

    Nope, doesn't make any difference... ahhh, this problem drives me crazy!!!

    Thanks anyway mate!


  4. #4
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Re: Using the Shell function

    Hello again,

    It seems to work for me....one thing I noticed though - you need to include the DOS name instead of the Windows one, i.e if you are specifying a path then My Documents becomes MYDOCU~1 - if you are specifying a file to open the pass the directory in the DOS format.

    Thanks

    Andrew


  5. #5
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    7

    Re: Using the Shell function

    i have copied both the executable and the file to convert to c: just for testing purpose so thera are no long file names. Also i have tried with other dos programs, for example Shell "Regsvr32.exe " & "test.dll" which works excellent. So I cannot understand why this wad3-program only runs from the command promt... it's coded with c++, so maybe I should make a post to that forum instead...


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