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 run .bat files

20 Feb 2015   #1

windows 7 64
Can't run .bat files

I know a similar topic has come up before but the solutions aren't working for me.
I got to this site as a result of googling my problem and getting to here:

I was in the situation where Windows7 would not recognise a .bat file at all (I would get 'file cannot be found' when right clicking on the bat file and selecting 'Open').

Having established that there was no file association for .bat I tried to fix it in the File Assocation manager by browsing to cmd.exe and selecting it.
This gave the appearance of being associated but still nothing worked.

Eventually I found the registry edit file above and tried to use that to fix the problem.

This got me a step further, in that double clicking a .bat file now opens the command processor, but the file still does not run. This might be because when running the .reg file I get messages that some keys cannot be imported because they are in use. However, I don't know how to get past this problem, because from my perspective I'm not running anything at the time. There are no apps running in task manager. I've tried running regedit in Safe mode but it produces the same messages.

I am Admin on my machine which is 64 bit Win7.

Just as background and not very relevant, this problem emerged when trying to set up an environment for an Android Studio course. Android studio appears to make lots of .bat calls to start up different features.
And of course none of them work for me. I can't change the calls that Android Studio is making. Lots of other people are using the same source material, apparently without this problem as no-one has any idea what I'm talking about.

The .bat calls are all very simple...and there are no spaces or odd characters in the path.
For example..

If anyone can suggest how I can complete the registry edit successfully, or has any other suggestions, I'd be grateful. I'm at a complete dead-end at the moment.



My System SpecsSystem Spec
20 Feb 2015   #2

Windows 7 Professional 64-bit

CTL-PNL --> Default Programs --> Set Associations, mine shows .bat associated with unknown application.
Registrar Registry Manager returns TMI. Trying W7Pro's regedit; Regedit's 1st .bat showing: .bat with PersistantHandler underneath; that's it; I guess the others hopefully can help you.
One program that might help:'s Windows Repair (All in One), download, install, run with defaults and add items 26 & 27; best run in Safe Mode w/Network; can be run in normal mode if your anti-viri/spy&mal-ware programs are off during the run.
My System SpecsSystem Spec
20 Feb 2015   #3

Windows 7 Ultimate x64/Windows xp Media center edition x64(Dual boot)/Windows10,Windows7,Ubuntu(64)

Try this... Open notepad. Then enter this following script and save as .reg file. But before you do this, go to regedit.exe, locate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.BAT\UserChoice and delete the key user choice. Then copy this script and save as .reg file. Example bat.reg and open file. If that doesn't work open the .zip file. It will fix the .bat association file. Run the file and it will fix the .bat. If you get an error with using the .zip file, enter into safe mode and try running the file again. I personally think you should use Fixexec because it is not a pain in the butt!

Windows Registry Editor Version 5.00



@="\"%1\" %*"

Attached Files
File Type: zip (1.1 KB, 65 views)
File Type: zip (176.5 KB, 32 views)
My System SpecsSystem Spec

20 Feb 2015   #4

64-bit Windows 10 Pro

Hello Peter, and welcome to Seven Forums.

If you like, you could download and merge the .reg file for the listed bat option in the tutorial below. This will restore the default associations and registry entries for .bat files, and should fix this for you. :)

Default File Type Associations - Restore
My System SpecsSystem Spec
21 Feb 2015   #5

windows 7 64

Thanks to all who have replied above; I appreciate your efforts to help.
Clearly my problem is non-standard.
I'm afraid none of the suggested edits fix the issue. I'm back to the position of bat files not being recognised.
The attachment shows what I get when I right-click a bat file and choose Open, or I just double-click the .bat file.
I have looked at the reg edits that have been posted ( and tried them all) and I'm pretty sure that every key in the registry is set to the values indicated in the suggested .reg files. Even so the problem remains.
I have since discovered that if I rightclick a .bat file and 'Run As Administrator' the file runs. However, my research suggest that it is impossible to set cmd.exe to run as admin automatically.

Attached Images
Can't run .bat files-bat1.png 
My System SpecsSystem Spec
21 Feb 2015   #6

64-bit Windows 10 Pro

Ok, so it's just not finding the .bat file instead.

Is this a shortcut of the .bat file you are trying to run? If so, are you able to directly run the .bat file?
My System SpecsSystem Spec
21 Feb 2015   #7

Windows 7 Professional 64-bit

I'm not sure if the above will of any help; can't make things any worse, I guess.
My System SpecsSystem Spec
21 Feb 2015   #8

windows 7 64

I'm not using any shortcuts. I'm trying to run the .bat files directly by double-clicking or Using Open.
If I use the command processor and navigate to the folder, i can run the bat file from there. (see below)

Attached Images
Can't run .bat files-bat2.png 
My System SpecsSystem Spec
21 Feb 2015   #9

windows 7 64

Thanks RolandJS
I'm afraid I've already applied that 'fix' - I deleted the UserChoice key.
My System SpecsSystem Spec
21 Feb 2015   #10

64-bit Windows 10 Pro

Are you having this issue with all .bat files, or just this specific one?

As a test, copy the .bat file to your desktop, and see if you are able to run it.

If not, then rename the .bat file, and try again.
My System SpecsSystem Spec

 Can't run .bat files

Thread Tools

Similar help and support threads
Thread Forum
Pagefile, Temporary Int Files, Temp files reset after update
Hello, I have a system with 32gb DDR3-2400, a 256GB SSD and a couple of spinners. I have set up 4gb of the RAM to be used as another RAMdisk using the softperfect software. This problem has been going on for some time, but has been more of a problem since I started using the RAMdisk. Not...
Performance & Maintenance
.wma files appears as .dat files in Temporary Internet Files folder
Hi, I am running IE8 on Windows 7 (Home Premium 64bit). My Temporary Internet Files folder is C:\Users\<username>\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5. I have enabled Show Hidden Files and Folders and removed the tick for Hide Protected Operating System...
Browsers & Mail
error-failed to load locale files from "Program Files\Western Digital\
failed to load locale files from "Program Files\Western Digital\WD Smartware\Locale" The menu box it's under is entitled " WDContextMenuHandler " I get this error when I just right click on any part of "my computer" everytime. the pc then goes blank on desktop while it says " windows...
BSOD Help and Support
Temp Internet files folder is 118GB full, but no files???
Hello. I hope that someone can help me with my problem. I a lower-intermediate on a computer. I have my tower pc on constant all day- to record a streaming IP Camera from my work. Initially, I saved these files into my docutments- which they would save as .avi files, and after every several...
Browsers & Mail
.reg files open Notepad - do not change registry to read older files
Running Win7Pro 64-bit. Am unable to open older Office 97 files with Office2003 which is installed and running fine. I found a couple of files here and elsewhere with .reg extensions that were supposed to make the necessary registry changes. eg. "UnlockWord.reg" and a more elaborate-looking...
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 22:51.
Twitter Facebook Google+