Solved "system cannot find the path specified" trying to run a .cmd from DOS

LoganTherrion

New member
Local time
7:22 AM
Messages
8
"system cannot find the path specified" trying to run a .cmd from DOS

Hi.

I'm using Win7 Enterprise.

I opened a DOS window as Administrator and I navigated to a directory with two files in it - someFile.cmd file and a someFile.jar file.

I typed this on the command line: someFile.cmd and I get, "The system cannot find the path specified". When I type someFile.jar and press Enter, I get no errors.

Just for fun I renamed the someFile.cmd to someFile.exe and tried to execute the someFile.exe from the same DOS window, and I got an error.

So for some reason, the DOS window has a hard time running the .cmd file. I even opened Windows Explorer and dragged the someFile.cmd into the DOS window and hit Enter, and that resulted in the same "cannot find the path specified" error. I'm pretty confidant it's related to the file's extension.

Does anyone know what's going on? This did not used to be a problem about a year ago (I haven't played with this since then) but it is now. And I do not know why or how to get around it.

Thanks in advance.

Logan
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
In the Dos window type
path <Enter>

if none of the paths are dot '.' then it will not search the current directory unless it happens to be explicitly listed.

To add the dot, right click on Computer, click Advanced System Settings, click Environment Button. In user variables it should say Path. Edit it and put ".;" at the beginning so it will search the current directory first. Make sure there is only one semicolon between each path like
.;c:\users\joe;c:\windows\system32;yaddd yadda

note: the yadda yadda is optional. :)

How java does it I don't know. It may have its own path variable that always has the current directory first.
 

My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Hey MilesAhead. Thanks for the lightning fast response.

Even if I am in the current directory and type the fully qualified path and filename (C:\folder\someFile.cmd), I still get the error.

Regardless, I updated my path statement so the first two chars are a dot and then a semi-colon. I then opened a new DOS window and tried navigating to the directory where my someFile.cmd lives, and tried to execute that, and got the same error.

For thoroughness - even though I'm in the dir with the file, I typed the fully qualified path to the .cmd file and hit enter and got the same error.

:/

Do you know of anything else I can try? This is pretty frustrating as it seems very inconsistent, given that it only throws that error on a particular type of file.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
The DOS window does recognize other .cmd files, just not the one I'm working with. I'll see if maybe it's just a corrupt .cmd file.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
What happens if you do
dir filename.cmd
??

does it show it existing?
 

My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Ok. You're not going to believe this. I can't hardly believe this.

Please note that this behavior is very reproducible.

As mentioned, in the directory I'm using I have two files that I care about. One is the .cmd file, the other is a .jar file.

When my code runs, if the .jar file isn't there (renamed, removed, et al), the .cmd file can execute without the "system cannot find the path specified" error,BUT I do get an error that reads, "Didn't find drive:\folder\someFile.jar in directory drive:\folder.".
I don't know what to think of this. I've never seen anything like it before. I get the same results regardless of how I execute the .cmd file regarding the presence of the .jar file. It appears now as though the .jar file may be the monkey wrench in the works.

If the .jar file is renamed and I do a "dir someFile.cmd" I get File Not Found. If I rename it back to .jar and re-run the same command I get the same error - File Not Found.

Please tell me you have some more ideas here...
:)

Logan



I sure hope you have some more ideas.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
Have you checked the properties of the .jar file to assure it's not marked as Hidden [Read-only shouldn't be a problem but wouldn't hurt to uncheck it also]? For a test have you tried changing the extension to .txt [about as simple file type there is]? Information about the .jar/Java Archive Files:
JAR File Extension - Open .JAR Files
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Customs, Dell, Gateway, HP, Toshiba, Acer, ASUS
OS
Windows 7 Ultimate 64-bit, Windows 8.1 64-bit, Mac OS X 10.10, Linux Mint 17, Windows 10 Pro TP
Keyboard
Microsoft
Mouse
Microsoft
Or just do dir with attribute
dir /AH somefile.cmd
 

My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
I have checked the properties actually. They are neither hidden nor read only, and it's not blocked or anything. I have full control to the files and the directory they're in.

I got the same properties whether it was renamed to .txt or as a .jar. The .jar is 2.3M in size, and has no special permissions. And the properties are the same for each file.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
I tried your suggestion and did a dir /ah someFile.cmd and dir /ah someFile.jar, and in both instances I got "File Not Found".

If I rename either to .txt and do dir /ah someFile.<extension>, then I get expected output.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
Just for grins I would log off, then log back on. Something is really weird if you can see the files in Explorer but dir command cannot see them. I don't think I've heard this one before.
 

My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
I have checked the properties actually. They are neither hidden nor read only, and it's not blocked or anything. I have full control to the files and the directory they're in.

I got the same properties whether it was renamed to .txt or as a .jar. The .jar is 2.3M in size, and has no special permissions. And the properties are the same for each file.

I tried your suggestion and did a dir /ah someFile.cmd and dir /ah someFile.jar, and in both instances I got "File Not Found".

If I rename either to .txt and do dir /ah someFile.<extension>, then I get expected output.
And yet you asked the dir command to only show you hidden files.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Ha! How embarrassing. My intellectual and command line prowess is scaring even me. :) Let me try that again.

dir /a someFile.jar: returns expected results (file size, name)
dir /a someFile.cmd: returns expected results (file size, name)

I'm checking out for the day soon but I will reboot again tomorrow morning. I agree - this is very strange. I've never seen behavior quite like this before.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
Process Monitor might give a clue if you can compare the results with a working computer or perhaps another user profile on the same computer.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
When my code runs, if the .jar file isn't there (renamed, removed, et al), the .cmd file can execute without the "system cannot find the path specified" error,BUT I do get an error that reads, "Didn't find drive:\folder\someFile.jar in directory drive:\folder.".
The output of the .cmd script clearly changes upon altering a file it reads/uses, and that's a clear indication that the script is indeed alive and running. It's more presumable that the error message, "system cannot find the path specified", is being thrown by the script itself, and not from the command interpreter.

Logan, have you considered creating and running a .cmd file that will Echo something like "Hello World"? Check if that works.


if none of the paths are dot '.' then it will not search the current directory unless it happens to be explicitly listed.
Rubbish.
 

My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Logan, have you considered creating and running a .cmd file that will Echo something like "Hello World"? Check if that works.

Why not cut to the chase? Unless it is confidential, just post the cmd script so we can see what is what.
 

My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
I found the problem, though the behavior I've seen doesn't really seem like the cause would result in the types of errors I was seeing. Regardless, it looks like the JAVA_HOME was - unbeknownst to me, being reset in a batch file. So the java.exe could never be found. I fixed this problem and all works as expected now.

Thanks everyone. You've all been exceptionally helpful and the turn around time and quality of your responses has been unprecedented.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
WIn 7 Enterprise
What do you see if you enter dir by itself?

Also, boot to Safe Mode or Safe Mode with Networking and try.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
Re: rubbish

Pyprohly said:

Apparently along the way they fixed this and I didn't notice. But it was true for years. That is why you saw command lines like .\mybatch.cmd to force the current directory search. But I did check for dot in my Path. It is not there. But it did find stuff in the current directory.

If anyone knows how many years it took them to fix it I would be curious. I know when I started with MSDOS 3.1 you had to add the dot to the path or type .\something.exe or the complete path to the file.

I am on Windows 8.0.
 

My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
I know when I started with MSDOS 3.1 you had to add the dot to the path or type .\something.exe or the complete path to the file.
I am on Windows 8.0.
I haven't noticed much difference in that in the Command Prompt window, just that there will be some things DOS that are not available in the Command Prompt on WinXP and later. I started with MS-DOS in '92 with Win3.1.

You say you are using Win8.0 and your System Specs shows Win7. I strongly suggest you Update to Win8.1 [free from the Store] as the touted Win10 Upgrade won't be free for Win8.0, only for Win7 w/SP1 and Win8.1.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Customs, Dell, Gateway, HP, Toshiba, Acer, ASUS
OS
Windows 7 Ultimate 64-bit, Windows 8.1 64-bit, Mac OS X 10.10, Linux Mint 17, Windows 10 Pro TP
Keyboard
Microsoft
Mouse
Microsoft
Back
Top