You double-click a .bat file that should run a series of commands, but Notepad opens and shows the script’s text instead. Nothing runs. When a Windows 10 BAT file opens in Notepad instead of running, the PAGODA127 LOGIN file association for batch files has been changed, or the file is not really a .bat file.
Windows normally runs .bat and .cmd files with the command processor, cmd.exe. If someone used “Open with” and ticked “Always use this app” with Notepad, or a text editor took over the association during installation, double-clicking opens the file for editing rather than running it.
Another common cause is a hidden extension: a file named script.bat.txt looks like script.bat when extensions are hidden, so Windows treats it as a text file.
Checking the real extension and restoring the association fixes the problem.
What Usually Triggers It
Batch files open in Notepad for these reasons:
- The .bat association was changed to Notepad or another editor.
- The file is actually named something like script.bat.txt.
- A text editor installer set itself as the default for scripts.
- Registry entries for batfile were damaged.
Right-clicking a batch file and choosing Edit opens Notepad by design; Open should run it.
First Steps to Try
Check the file and run it directly.
- In File Explorer, turn on View > File name extensions.
- Confirm the file ends in .bat, not .bat.txt, and rename it if needed.
- Right-click the file and choose Open or Run as administrator to see whether it runs.
- Run it from Command Prompt by typing its full path and pressing Enter.
- Check whether .cmd files behave the same way.
Batch files placed in protected folders, such as Program Files, may also fail to run correctly without administrator rights, so test them from a normal folder like Documents.
If the Problem Continues
Restore the batch file association.
- Open Command Prompt as administrator.
- Type assoc .bat=batfile and press Enter.
- Type assoc .cmd=cmdfile and press Enter.
- Type ftype batfile=”%1″ %* and press Enter.
- Type ftype cmdfile=”%1″ %* and press Enter, then test the file again.
If this does not work, check HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat and delete its UserChoice subkey after exporting it.
Protect Your Data First
Read a batch file in Notepad before running it if it came from someone else; scripts can delete files or change settings. Never run batch files received unexpectedly by email.
The Bottom Line
Batch files open in Notepad when the association changed or the real extension is .txt. Show extensions, rename the file correctly, restore assoc and ftype settings, and remove a bad UserChoice entry if needed.