When I click a .bat file it gives me a message: "How do you want to open this file?" 1st picture for reference.

I expect a batch file to run a cmd for me, so even when I click an option to open the file with cmd it doesn't work. I tried creating a simple .bat command:

@echo off

title This is your first batch script!

echo Welcome to batch scripting!


But when I do that the file itself doesn't even look like a .bat file: 2nd picture for reference

...and doesn't open cmd as it should.

I think there is something wrong with the .bat in regedit.

  • 1
    See if this helps>>>>winhelponline.com/blog/…
    – Moab
    Jan 12, 2021 at 15:59
  • @Moab Thank you for your help. If anyone else has this problem you can keep this thread open. Maybe I didn't understand people who know more about the computer language so I didn't know where to go and what to do. That's why my question looks unprofessional (but maybe this is what people are looking for (simplicity)). <3
    – Ugapiku
    Jan 12, 2021 at 16:34
  • if you rename your .bat to .cmd the same happen?
    – Io-oI
    Jan 17, 2021 at 0:49

1 Answer 1


As an alternative you can also fix this from an elevated command prompt.

Open an elevated command prompt and type this:

assoc bat=batfile
ftype batfile="%1" %*

enter image description here

  • For some reason it did not work when I tried it manually just like you're showing. So I had to download .bat file association. Unfortunately I forgot to take screenshots.
    – Ugapiku
    Jan 12, 2021 at 16:51
  • Did you get any error messages or just didn't work? Jan 12, 2021 at 16:54
  • Yes, there were messages in cmd, but I don't remember what exactly it said.
    – Ugapiku
    Jan 12, 2021 at 16:58
  • Maybe "access denied" if you didn't run from elevated command prompt Jan 12, 2021 at 17:01
  • No, it was something like "missing..." or "registry does not exist".
    – Ugapiku
    Jan 12, 2021 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .