Can't open .bat file

Page 2 of 2 FirstFirst 12

  1. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #11

    Add a pause command so the CMD window will stay open and you can see the error message(s) !!!
      My Computer


  2. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #12

    Here is a very simple bat file i just created.
    The 1st command is dir - a valid command
    The 2nd command is dirt - an invalid command
    The 3rd command is pause - so I can see the error
    Code:
    dir
    
    dirt
    
    pause
    Here is a screen print showing the bat file error, because I have the pause command:

    Can't open .bat file-bfesp01.png
      My Computer


  3. Posts : 6,285
    Windows 10 Pro X64
       #13

    Put the pause in as the last line of the batch file as you were asked to do. That will keep the window from closing so you can see what the error is.

    As for my question. To open a Elevated Command prompt, click on Start, type cmd. Right click on cmd.exe at the top left of the Start window and select Run as Administrator.

    In the Command Prompt window,

    Type echo %pathext% and press Enter.

    Result should look like this:

    >echo %pathext%
    .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
      My Computer


  4. Posts : 3,371
    W10 Pro desktop, W11 laptop, W11 Pro tablet (all 64-bit)
       #14

    Since we don't know hat the .bat file is trying to do, we have no way of knowing how to advise you.

    You say the .bat file crashes when you run it because the command window opens then closes. That is the expected result of running a .bat file by double-clicking it unless something in the .bat file prevents that such as a pause prior to the .bat file ending which will prevent the command window from closing and perhaps allow you to see if there have been errors outputted to the command window.

    Would it be possible for you to upload the .bat file here so we could see what it is trying to do?
      My Computer


  5. Posts : 10
    Windows 7 Ultimate 64bit
    Thread Starter
       #15

    Sorry to not listen to your advise(s). But, thanks it work! Thank to everyone who is try to 'fix' my problem!
      My Computer


  6. Posts : 10
    Windows 7 Ultimate 64bit
    Thread Starter
       #16

    But this is strange, because before I reinstall my Windows, I don't need the pause command
      My Computer


  7. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #17

    Glad to hear you got it fixed.

    The pause command does nothing to fix any problems in the BAT file.

    All it does is prevent the CMD window from closing so you can see what the BAT file did, and if there are any errors you can see the error message(s) and make changes to fix them.

    If you have errors in a BAT file you can post them here like I did in post #12 and someone should be able to help you.
      My Computer


 
Page 2 of 2 FirstFirst 12

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:22.
Find Us