Can't open .bat file

Page 1 of 2 12 LastLast

  1. Posts : 10
    Windows 7 Ultimate 64bit
       #1

    Can't open .bat file


    Hello! I recently reinstall my laptop with Windows 7 Ultimate 64-bit. I think everything is alright and I didn't find any 'critical' error. After reinstall complete, then I re-install all my software back (like IDM, Google Chrome, Notepad++, Steam, etc). But now I found a problem! I make a .bat file but can't open it. When I double click on it, the cmd window appear and then disappear and nothing happen! I try to make .bat file again but this time, with a simple command. But the cmd still crash. But when I install a RIP game (with the main installation file named "unpack.bat") the cmd show and everything work properly! I hope there are someone there want to help me

    Also, "sorry for my bad english"
      My Computer


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

    Double-clicking on a file will cause the default action to be performed for that file. For most files, there is an associated program that will be invoked and the file passed as a parameter to it so the file will be opened in that program. For files like .bat, .exe .com, their default action is to be executed. When you double-click on a .bat file, then the system will run the .bat file which is why you see the command window open and close.

    In order to edit a .bat file, you need to right-click on it and select Edit or Open from the menu.
      My Computer


  3. Posts : 1,346
    Windows 7 Professional x64
       #3

    can2x said:
    Hello! I recently reinstall my laptop with Windows 7 Ultimate 64-bit. I think everything is alright and I didn't find any 'critical' error. After reinstall complete, then I re-install all my software back (like IDM, Google Chrome, Notepad++, Steam, etc). But now I found a problem! I make a .bat file but can't open it. When I double click on it, the cmd window appear and then disappear and nothing happen! I try to make .bat file again but this time, with a simple command. But the cmd still crash. But when I install a RIP game (with the main installation file named "unpack.bat") the cmd show and everything work properly! I hope there are someone there want to help me

    Also, "sorry for my bad english"
    What is the purpose of the .bat file you are creating? Are you trying to execute it or edit it? You can post the file in the forum for analysis, if you want further help.
      My Computer


  4. Posts : 6,285
    Windows 10 Pro X64
       #4

    Also, open a Elevated Command Prompt.
    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


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

    strollin said:
    Double-clicking on a file will cause the default action to be performed for that file. For most files, there is an associated program that will be invoked and the file passed as a parameter to it so the file will be opened in that program. For files like .bat, .exe .com, their default action is to be executed. When you double-click on a .bat file, then the system will run the .bat file which is why you see the command window open and close.

    In order to edit a .bat file, you need to right-click on it and select Edit or Open from the menu.
    My problem is, if I double click the .bat, a cmd window (or something ...) appear and disappear. Um, I mean, it always crash! I didn't choose any other text editting program (like Notepad) as 'default action'
    Last edited by can2x; 09 Jun 2014 at 06:42. Reason: Missing some word
      My Computer


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

    Ztruker said:
    Also, open a Elevated Command Prompt.
    Type echo %pathext% and press Enter.

    Result should look like this:

    >echo %pathext%
    .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    Sorry, but I don't understand what do you mean
      My Computer


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

    Add a pause command as the last command in your bat file.
    That will keep the CMD window open until you click on it ...

    You need to edit the bat file as strollin explained in post # 2:
    In order to edit a .bat file, you need to right-click on it and select Edit or Open from the menu.
      My Computer


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

    DavidW7ncus said:
    Add a pause command as the last command in your bat file.
    That will keep the CMD window open until you click on it ...

    You need to edit the bat file as strollin explained in post # 2:
    In order to edit a .bat file, you need to right-click on it and select Edit or Open from the menu.
    I know how to edit that. I used both Notepad and Notepad++, but the window still crash and won't execute command (even I'm using simple command as a test)
      My Computer


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

    did you add a pause command as the last statement (command) ?
      My Computer


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

    DavidW7ncus said:
    did you add a pause command as the last statement (command) ?
    No, but that time (before I reinstall my PC) i make a .bat (simple command too). But then I watch a youtube video "How to make a Text-based Game" (There, I learn some basic batch code). I try it myself and it work! But now, I doing it again but this time, it fail! I make other batch file, the same crash happen! What should I do?
      My Computer


 
Page 1 of 2 12 LastLast

  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 17:57.
Find Us