Batch (.BAT) Files Not Running in Windows 11/10

Published by Nyau Wai Hoe - Updated on

If you use Windows and have ever tried working with batch files, you might have noticed sometimes they don’t do what you expect when you double-click them. They could open in a text editor, show errors, or not do anything at all.

This issue can happen for a few reasons, like changes to how Windows handles file extensions or simple mistakes on our part. In this guide, we’ll look at why this happens with .BAT files on Windows 11 or Windows 10 and show you how to fix it and get your scripts running smoothly again.

BAT Files Not Running Windows 11 10

What are batch files?

First off, batch files are scripts filled with commands or programs that run one after the other automatically, without needing us to start each one manually.

They’re super useful for doing the same thing over and over, like opening a bunch of commands all at once or setting up your system in a specific way. You can write them in any simple text editor (like Notepad or Visual Studio Code) and save them with a .bat at the end. They work on all versions of Windows and you can start them from the command line or just by double-clicking their icon.

Handy tip: How to batch rename files in Windows 11

Why are your .BAT files not opening after double-clicking?

Several things could stop your batch files from opening or running right when you double-click them in Windows 11/10. Here’s what might be going on:

  • Sometimes, the program that should open .bat files gets switched to something else like a text editor or another app that can’t run scripts.
  • The settings for .bat files might be wrong or missing in Windows.
  • There could be mistakes in the batch file itself that stop it from running.
  • The command prompt might not be set up or available on your computer.
  • Your security software might think the batch file is a risk and stop it from running.
  • You might not have the right permissions to run batch files or get into certain folders.

How to fix Windows 11/10 .BAT file not running problem?

Depending on what’s causing the trouble, different fixes might work. Here are some ways to get your Windows batch (.BAT) files working again after double-clicking.

See also: How to run batch file without the CMD window

Use a registry fix to repair .BAT file association

Since you can’t change how .bat files are handled from the settings, fixing the registry is the way to go. You can either tweak the registry yourself with the steps below or use our quick fix.

But careful, messing with the registry can be tricky and might cause big problems if not done right. So, make sure to create a system restore point before you start, so you can undo changes if needed.

  1. Grab the .bat file association registry fix.
  2. Unzip the file you downloaded to a spot on your computer.Batch file won't run or open Windows 11
  3. Run the “fix_bat_windows.reg” file by double-clicking it.
  4. Hit “Yes” when it asks if you’re sure.BAT extension not open with CMD
  5. Restart your computer.

After you do this, .bat files should work like they’re supposed to again.

Fix the .BAT file association manually using Registry Editor

If you want to handle it yourself in the Registry Editor, here’s how. Just remember, changing the registry can be risky, so please make a system restore point first, just in case.

  1. Press Win + R, type “regedit”, and hit Enter to open the Registry Editor.Open Registry Editor
  2. Go to this part of the registry by clicking through the folders:
  3. Change the “(Default)” value to “batfile” to fix .bat file settings.Windows 11 bat run problem
  4. Then, make sure the “(Default)” value under:

    is not set to anything. If it is, delete it.bat file not working

  5. Next, head to:
  6. Change the “(Default)” value to "%1" %*, including the quotes and space. This tells Windows to use the command prompt to open .bat files.Windows batch file not opening
  7. Finally, go to:
  8. Delete the “.bat” key and restart your computer.

Once you’ve done this, your batch files should be back to normal.

Check your batch file for mistakes

Ever run into trouble where your batch file just won’t do its thing? It might be because of mistakes in your code or using commands that don’t play nice. You can grab a text editor like Notepad++ that shows your code in different colors to spot errors easier. Also, giving it a go from the command prompt can help you see where things are going wrong.

Just pop open the Command Prompt, move it to where your batch file lives by typing in its home address, then type the file’s name with .bat at the end and hit Enter. If something’s not right, the command prompt will let you know by stopping the script and showing you what’s up.

bat file not running Windows 11

Make sure you can use Command Prompt

If your batch files aren’t running on your Windows 11/10 computer, it could be because Command Prompt (CMD) isn’t ready for action. Here’s a quick way to check:

  1. Hit the Start menu and type “cmd” in the search bar.
  2. Click on “Command Prompt” from the search results to open it.Open CMD Windows 11
  3. If Command Prompt opens up, you’re good to go.
  4. If it doesn’t open or you get an error, then Command Prompt might be turned off.

How to get Command Prompt back on Windows 11/10

Found out Command Prompt is off-limits? No worries, you can switch it back on through the Local Group Policy Editor like this:

  1. Press Start and look up “gpedit.msc” or just “Local Group Policy Editor”.
  2. Click on it from the search results to jump in.Open Group Policy Editor Windows 11
  3. Follow this path:
    User Configuration > Administrative Templates > System
  4. Double-tap on “Prevent access to the command prompt” policy.Check if CMD is disabled
  5. Pick “Disabled” or “Not configured” and hit “OK”.Prevent access to Command Prompt Windows 11
  6. Close the Local Group Policy Editor and give your .bat file another try.

If getting into the Local Group Policy Editor is a no-go, you can also flip the Command Prompt switch through the Windows Registry Editor:

  1. Hit Win + R, type “regedit”, and press Enter.Open Registry Editor
  2. Make your way here:
  3. Look for “DisableCMD” or “DisableCMDAccess”.
  4. If you spot it, open it up and change the Value data to “0”.
  5. Close the Registry Editor and try running your .bat file once more.

Check your security software

Sometimes, your antivirus might get a bit too protective and stop your batch file from running, thinking it’s up to no good. If you think your antivirus is getting in the way, you might want to turn it off for a bit or tell it to ignore your .bat file through an exception.

Just a heads-up, turning off your antivirus leaves your computer open to bad stuff, so don’t forget to turn it back on after you’re done checking your batch file.

Whitelist Antivirus

Make sure you have the right permissions

Running into roadblocks with your batch file might also mean you don’t have the permissions to do what you’re trying to do. You might need to let your user account know it’s okay to run batch files or access certain places on your computer.

Also, check this out: How to take ownership of a file, folder, or drive in Windows 11

  1. Right-click the folder where your batch file hangs out.
  2. Hit “Properties” then scoot over to the “Security” tab.
  3. See if you’ve got “Full control” or “Read & execute” rights.Check folder permission
  4. If not, hit “Edit” and add yourself to the VIP list.
  5. Tick “Full control” or “Read & execute” and click “OK”.
  6. Do the same for any other spots your batch file needs to touch.

One last piece of advice

We’ve covered several ways to fix .BAT files that won’t run in Windows 11 or 10, like using a registry fix, turning on Command Prompt access, and adjusting your antivirus settings. If these don’t work, there might be other issues with your batch file itself. Double-check it for any mistakes or missing commands. Hopefully, one of these solutions gets your batch files running properly again.

Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link