Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Can't open .bat file

08 Jun 2014   #1
can2x

Windows 7 Ultimate 64bit
 
 
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 System SpecsSystem Spec
.
08 Jun 2014   #2
strollin

W10 Pro desktop, W10 laptop, W10 laptop, W10 Pro tablet (all 64-bit)
 
 

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 System SpecsSystem Spec
08 Jun 2014   #3
Sir George

Windows 7 Professional x64
 
 

Quote   Quote: Originally Posted by can2x View Post
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 System SpecsSystem Spec
.

08 Jun 2014   #4
Ztruker

Windows 10 Pro X64
 
 

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 System SpecsSystem Spec
09 Jun 2014   #5
can2x

Windows 7 Ultimate 64bit
 
 

Quote   Quote: Originally Posted by strollin View Post
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'
My System SpecsSystem Spec
09 Jun 2014   #6
can2x

Windows 7 Ultimate 64bit
 
 

Quote   Quote: Originally Posted by Ztruker View Post
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 System SpecsSystem Spec
09 Jun 2014   #7
DavidE

Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64
 
 

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:
Quote:
In order to edit a .bat file, you need to right-click on it and select Edit or Open from the menu.
My System SpecsSystem Spec
09 Jun 2014   #8
can2x

Windows 7 Ultimate 64bit
 
 

Quote   Quote: Originally Posted by DavidW7ncus View Post
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:
Quote:
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 System SpecsSystem Spec
09 Jun 2014   #9
DavidE

Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64
 
 

did you add a pause command as the last statement (command) ?
My System SpecsSystem Spec
09 Jun 2014   #10
can2x

Windows 7 Ultimate 64bit
 
 

Quote   Quote: Originally Posted by DavidW7ncus View Post
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 System SpecsSystem Spec
Reply

 Can't open .bat file




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Open File - Security Warning : Allow or Prevent to Unblock File
Allow or Prevent to Unblock a File to Stop the "Open File - Security Warning" Prompt This will show you how to allow or prevent all users from being able to stop the Open File - Security Warning prompt by removing the unblock button and Always ask before opening this file check box for a...
Tutorials
I need a batch file to open a random file within a certain folder/path
I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'. I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands,...
General Discussion
File Open or Choose File dialog hangs application after selection made
Hi. Windows 7 Pro SP1 64 bit Intel i5 CPU @2.67 GHz 8 GB RAM This problem just started recently or I only noticed it in the past week or so. When I'm in any application that launches the File Open dialog, including any browser's "Select File/Browse" button to choose a local file, when I...
General Discussion
when open a word file or pwrpnt file another file is opens
God bless you, I am not a computer person please help me to fix the problem I have. Every time I open a word, power point and note pad program another file is opens with that (with a infinity sign in the front with the same extension ) is that a thread or how can I stop this thank you...
Microsoft Office
Open File Security Warning when file is on different local hard drive
Hello and this is my First Post Can you help me with an annoying dialog that pops up when running shortcuts please? I have (portable) applications located on E: I can run those applications directly from E: without a problem - i.e. I don't get any warnings. However if I create a...
System Security
Open Excel file to directly open from IE9
Hello guys, I wanted to open an excel file directly from IE9, but when I double click the excel file in the browser, it opens right in IE instead of Excel program. How do I make the file use Excel program to open rather than open in IE itself? I am using Windows 7 and Office 2010. I tried the...
Microsoft Office


Our Sites

Site Links

About Us

Find 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 11:59.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App