Windows – Double Clicking Batch File Windows cannot find file

batch filecmd.exewindows

I've found variants of this question being asked all over the place, and I've attempted all of the actual answer I've found out there (including changing the registry for associations). The basic issue is this:

  1. I create a batch file (simple batch that has an echo and a pause) on the desktop or in any folder in the computer.
  2. I double click the batch file to run it and get:

enter image description here

Workarounds include:

  1. Right click and run as administrator
  2. Open command prompt and call the batch file by name

I was dealing with the issue by just using those workarounds for a while, but I'm starting to think my inability to get certain programs to work properly (android.bat in Android Studio won't run because of file not found despite being there, for instance) is related to this issue. If I can't get it fixed in the next week, I'm likely going to reformat.

Additional info:

  1. This is Windows 8.1 Pro 64-bit
  2. There are no other file types which have this double-click execution issue
  3. If I call a batch file from another batch file using the workarounds, it works
  4. This happens regardless of the folder I'm in, and does not happen on a Hyper-V virtual machine using the same copy of windows
  5. All windows updates are run and I've done virus scans and such – the only other thing that's been going wrong simultaneously is that the machine seems to be slowing down a bit (in particular when I try to open file dialogs in ANY program – which now take ~5 seconds to open instead of being instantaneous).

Any ideas would be much appreciated! It may just be time for a reformat (it's been a year or so).

Edit: Wasn't aware of SuperUser. Seems like this question may be more appropriate over there!

Edit 2: Anyone over here have an ideas?

Best Answer

Check your system environment COMSPEC. It should be something look like %SystemRoot%\system32\cmd.exe. If it was altered for what ever reason , bat files won't be able to run by double click.

Related Question