Windows cannot find .bat. Make sure you typed the name correctly, and then try again
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.
Related videos on Youtube
CyanFlare
Updated on September 18, 2022Comments
-
CyanFlare over 1 year
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.
-
harrymc over 5 yearsYou need to show us a screenshot of what happens in a Command Prompt window, and also the file association registry entries.
-
CyanFlare over 5 yearsHere is an image of the error. i.imgur.com/789l25n.png
-
Vomit IT - Chunky Mess Style over 5 yearsYou might try first from command line run
FTYPE batfile="%1" %*
and then runASSOC .bat=batfile
, and see if that helps. If not, then from an admin elevated command prompt, type insfc /scannow
and press Enter. Let that complete, reboot the PC, and then try again. -
harrymc over 5 yearsApart 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. -
CyanFlare over 5 yearsI tried what pimp juice and harrymc said but i still cannot open the bat file.
-
-
CyanFlare over 5 yearsThis did not fix the issue.
-
Squashman over 5 yearsEnvironmental variables are not case sensitive. My compsec variable is in camel case and works just fine.
ComSpec=C:\WINDOWS\system32\cmd.exe
-
fixer1234 over 5 yearsIf this change fixed it for you, it suggests that the problem was a hiccup, and not reproducible.
-
Salman about 3 yearsHow in the world that works out :P I was running into Flutter setup error and this helped me out after long hours of struggling. Thanks a lot.
-
Charles Kenyon almost 3 yearsI do not see Squashman, above. Are you perhaps posting in the wrong question?
-
RipSurge almost 3 yearsHe commented on the above posted (currently chosen/voted) answer on Nov 29 '18. You should see it as a comment/reply below the original poster's answer posted above.