Windows 7 Problem with Simple BAT file

Discussion in 'Programming and Scripting' started by English Rebel, Jun 8, 2013.

  1. English Rebel

    English Rebel New Member

    Joined:
    Jun 8, 2013
    Messages:
    6
    Likes Received:
    0
    I have created a batch file to run three programs. However it doesn't run the first two just the last one. Whenever the batch file is running I see a window open and quickly close when each of the first two programs are requested to run. The window is only open for a second so I cannot see what it is but appears to be a standard Windows window that is empty but I can just make out the name of one of the programs in the bar at the top.
    For each file I'm adding the line Start "" "the executable file path"
    Here's what I used in the batch file:


    @echo off
    Start "" "the executable file path"
    Exit

    Any idea why the first two programs won't run as I can double click their .exe files or their shortcuts and they run just fine? Is there a way to see what happened when the batch file ran (a Windows log file perhaps)?
    Thanks
    Alan
     
  2. English Rebel

    English Rebel New Member

    Joined:
    Jun 8, 2013
    Messages:
    6
    Likes Received:
    0
    I think I've answered my own question. The two exe files won't run because they need an INI file. The solution is to add a CD line with the folder location and then a START XXX.exe. The third program ran because it doesn't need an INI file.
     
  3. patcooke

    patcooke Microsoft MVP
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    May 16, 2010
    Messages:
    5,456
    Likes Received:
    268
    ok - for future reference you could use the "PAUSE" command at points where you want to monitor activity - this will execute the batch file as far as the pause commend then wait for a key to be pressed before continuing.
     
  4. English Rebel

    English Rebel New Member

    Joined:
    Jun 8, 2013
    Messages:
    6
    Likes Received:
    0
    Okay thanks I'll remember that for future troubleshooting. I think in my case the program window that briefly appeared would not pause.
     
  5. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    You can also use start /d <path_here> to specify the path the program should execute in, thus eliminating the need for the CD command. (much cleaner)

    Obtained from "start /?"

    START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
    [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
    [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]
    [command/program] [parameters]

    path Starting directory.
     

Share This Page

Loading...