I have no idea when this started to happen but it is preventing me from opening .bat files on double click. I am only able to run it as administrator. Is there anyway to fix this so i can double click instead of running as administrator? This causes some programs not to work.

I've tried to reset the file association in the registry, checked the environment variables, and I checked to see if cmd was actually in the System32 folder.

If more info is needed, I will try to provide it.

  • You need to show us a screenshot of what happens in a Command Prompt window, and also the file association registry entries. – harrymc Nov 25 '18 at 7:41
  • Here is an image of the error. i.imgur.com/789l25n.png – CyanFlare Nov 25 '18 at 7:56
  • 1
    You might try first from command line run FTYPE batfile="%1" %* and then run ASSOC .bat=batfile, and see if that helps. If not, then from an admin elevated command prompt, type in sfc /scannow and press Enter. Let that complete, reboot the PC, and then try again. – Pimp Juice IT Nov 25 '18 at 8:43
  • Apart from the advice by @PimpJuiceIT, I notice that the .bat file is on the desktop. Try to copy it to some folder and start it from there. This might be a matter of permissions. – harrymc Nov 25 '18 at 12:14
  • I tried what pimp juice and harrymc said but i still cannot open the bat file. – CyanFlare Nov 25 '18 at 16:48

I think this is related to cmd, not to your specific bat file. so open cmd (start menu >> RUN >> type cmd and press ENTER) on the task bar, right click on the cmd icon, you will see a small menu, right click on the first option in is ( Command Prompt )... now choose Properties , then in Shortcut tab press Advanced, then check Run As Administrator then press OK and OK try now to run your bat file...

please comment if this did not solve your case... otherwise vote my answer as a solution...

  • This did not fix the issue. – CyanFlare Nov 25 '18 at 7:56

Okay, some of you might think I'm stupid but this is how I solved this issue.

I went into my environment variables and was looking for COMSPEC but instead I found ComSpec. Once I renamed it back to COMSPEC everything started working again.

I have no idea how it was even renamed in the first place but that fixed my issue.

Hope this helps other people with this issue.

  • Environmental variables are not case sensitive. My compsec variable is in camel case and works just fine. ComSpec=C:\WINDOWS\system32\cmd.exe – Squashman Nov 29 '18 at 4:19
  • If this change fixed it for you, it suggests that the problem was a hiccup, and not reproducible. – fixer1234 Dec 2 '18 at 2:16

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.