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

Page 1 of 3 123 LastLast

  1. Posts : 8
    WIn 7 Enterprise
       #1

    "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


  2. Posts : 5,092
    Windows 7 32 bit
       #2

    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


  3. Posts : 8
    WIn 7 Enterprise
    Thread Starter
       #3

    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


  4. Posts : 8
    WIn 7 Enterprise
    Thread Starter
       #4

    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


  5. Posts : 5,092
    Windows 7 32 bit
       #5

    What happens if you do
    dir filename.cmd
    ??

    does it show it existing?
      My Computer


  6. Posts : 8
    WIn 7 Enterprise
    Thread Starter
       #6

    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


  7. Posts : 1,519
    Windows 7 Ultimate 64-bit, Windows 8.1 64-bit, Mac OS X 10.10, Linux Mint 17, Windows 10 Pro TP
       #7

    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


  8. Posts : 5,092
    Windows 7 32 bit
       #8

    Or just do dir with attribute
    dir /AH somefile.cmd
      My Computer


  9. Posts : 8
    WIn 7 Enterprise
    Thread Starter
       #9

    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


  10. Posts : 8
    WIn 7 Enterprise
    Thread Starter
       #10

    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


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:22.
Find Us