Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Alert

Batch file "windows cannot find the specified path"

Jul 10, 2014 4:00AM PDT

Whenever I try to open a bat file it says "windows cannot find the specified path" error message.
Previously it worked fine. But 3 days back I started seeing this problem.

I googled and tried some solution . But still I get this message.I can run as admin or run from cmd.

But can't double click. Also if some .bat refers another bat then running as admin does not help. The refered .bat does not execute.

I have checked cmd.exe is present in my System32.


Please help.

Discussion is locked

- Collapse -
You may have to share the batch file.
Jul 10, 2014 4:34AM PDT

As to going from bat file to another, well unless you use the full path or set your current directory but hey, I'm getting ahead of myself.
Bob

- Collapse -
This not particularly with any specific batch file.
Jul 10, 2014 4:52AM PDT

This not particularly with any specific batch file. Not a single one is working.
The one that I mentioned that is calling other bat from within it is the pmt.bat for was profile creation

- Collapse -
The current folder could cause all to fail.
Jul 10, 2014 5:02AM PDT

As you know when you double click a .bat file the command processor spins up and as the programmer you are never quite sure which folder you are in at the beginning. It could change from account to account and more.

Why not check that out now?

Here's a simple 2 line batch to show this.

cd
pause

Maybe pause alone will do but I put in cd to be sure.
Bob

- Collapse -
It is showing the current dir
Jul 10, 2014 5:46AM PDT

Hi,

I wrote cd pause and executed from cmd. it is showing the path where the bat is that is C:\Users\<userName>\path..to...bin

- Collapse -
Contd..
Jul 10, 2014 5:47AM PDT

But as I double click this bat it shows the same message.

- Collapse -
CD PAUSE is not the same as
Jul 10, 2014 5:53AM PDT

CD
PAUSE

Your reply here is missing something.

C:\Users\<userName>\path..to...bin is pretty invalid on many points. Pretty messed up?
Bob

- Collapse -
I wonder if your PC lost the BAT file association.
Jul 10, 2014 6:11AM PDT
- Collapse -
his AV may be blocking it too
Jul 10, 2014 5:23PM PDT

He should register it to be ignored by his AV.

- Collapse -
several possibilities
Jul 10, 2014 5:21PM PDT

maybe using relative path instead of a full path, and the batch file was moved to another folder, causing the relative path to be wrong now.

using long file names instead of the DOS abbreviated ones in a path. For instance using Program Files instead of Progra~1

error could be from main batch file or the one called

don't use caps in the batch commands, like echo instead of Echo or pause instead of Pause