Announcement

Collapse
No announcement yet.

Problem with dos exe closing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with dos exe closing

    I have a file type that opens with a dos exe that closes when done. I need to keep the window open so I can read the output. I'm using Win7.

    I've tried to associate the file type to a batch file with a pause command, but the file name isn't passed on to the exe.

    Any ideas?

  • #2
    Put the call to the program in a batch file, along with the pause command:

    Code:
    @echo off
    your_command.exe %*
    pause
    and call the batch file with the command line arguments you want to pass to the EXE.

    For more info on using command line parameters in a batch file, here's one site with info:
    http://stackoverflow.com/questions/2...-in-batch-file

    Comment


    • #3
      The only parameter I need to pass on is a file name that is always changing and in different places.

      Example:

      -double click 1.jpg in windows explorer
      -jpg's are set to open with jpgopener.bat
      Code:
      @echo off
      jpgopener.exe
      pause
      In this case 1.jpg isn't passed onto jpgopener.bat and therefore not passed onto jpgopener.exe

      I could add the jpg's location to the .bat with a command line argument(as you suggest):

      Code:
      @echo off
      jpgopener.exe %1
      pause
      But I would have to get the location of the jpg and pass it on to the .bat every time. Multiple files, multiple locations. Very tedious.

      Comment


      • #4
        Put the batch file (or a shortcut to it) in the "Send To..." folder (c:\documents and settings\<username>\SendTo.) You may need admin privileges to access this folder in Vista/Win 7.

        Then just right click your file, and select "Send to..." and pick your batch file. The %1 argument will contain the file name you "sent" to the batch file (more properly termed 'command' files in NT/XP/Vista etc.)

        [EDIT] In Win7, the SendTo folder is in c:\users\<username>\AppData\Roaming\Microsoft\Wind ows\
        Last edited by Dr. Death; 07-28-2010, 04:37 AM.
        National Sarcasm Society
        "Like we need your support."

        Comment


        • #5
          Thank you, that works. But it didn't stop the closing window problem.

          After a lot of trial and error I got this to work:

          cmd /k "C:\Program Files\program.exe" -a %1

          Comment

          Working...
          X