Can't run .bat files

Stoigniew Milczarski 0 Reputation points
2023-07-24T20:59:02.3+00:00

My computer can't run .bat files when i try to run one it shows this error

User's image

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,988 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. workforce45 626 Reputation points
    2023-07-24T22:58:15.0833333+00:00

    Hi Stoigniew,

    Disclaimer: We have mentioned a registry fix for the stated problem, it is recommended to take a backup of your entire machine including bookmarks, outlook data files and your user library files before performing the below mentioned practice to fix the issue with .bat extension. If the registry entries are incorrectly configured it may turn up to a no boot situation. It advised to perform these steps in the present of an expert or a professional.

     

    Type “regedit” in the Windows search and press Enter to open the Registry Editor. Please follow the below mentioned changes to be made in registry.

     

    ·         First, Navigate to the following key:

    HKEY_CLASSES_ROOT.bat

    In the right pane, double-click on the “(Default)” value and set its value data to “batfile“. This will restore the default file association for .bat files.

    ·  Next, navigate to the following key:

    HKEY_CLASSES_ROOT\batfile\shell

    In the right pane, make sure that the “(Default)” value is not set. It should show “value not set“. If there is any other value present, right-click on “(Default)” and select “Delete” to remove it.

    ·         Then, navigate to the following key:

    HKEY_CLASSES_ROOT\batfile\shell\open\command

    Double-click on the “(Default)” value in the right pane.

    In the “Value data” field, enter "%1" %*. Make sure to include the quotation marks and the space between %1 and %*. This will set the default command for opening .bat files to the command prompt.

    ·         Then, navigate to the following key:

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.bat

    Right-click on the “.bat” key and select “Delete“. Confirm the deletion when prompted.

    ·         Finally, Navigate to the following key:

    HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System

    Check if there is a value called “DisableCMD” or “DisableCMDAccess“.

    If so, double-click on it and set the Value data to “0

     

    Close the registry editor and restart your machine, run .bat file and please update with your findings.

     

    Thanks!

    1 person found this answer helpful.