System will not run .bat files

Page 1 of 2 12 LastLast

  1. Posts : 2
    Windows 7 64 bit
       #1

    System will not run .bat files


    A while ago on my laptop I was messing around with the privilages with cmd. I stupidly deleted and removed it. Don't ask why. So now when I go "Run" and search "cmd" it cannot find it. At the same time this happened I was not able to run .bat files. It comes up with "Windows cannot find (the path). Make sure you typed the name correctly then try again". This happens when I click or search for a .bat file. I'm cluess on the problem of how to fix it and would appreciate some helpful advise. Thank you.
      My Computer


  2. Posts : 10,485
    W7 Pro SP1 64bit
       #2

    My testing inside of a virtual machine indicates that these steps should work for you:
    System Restore
      My Computer


  3. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #3

    Someone else had the same problem. See the thread here and also check post #23.

    Maybe you have the same issue?

    Can't run .bat files
      My Computer


  4. Posts : 10,485
    W7 Pro SP1 64bit
       #4

    Callender said:
    Someone else had the same problem. See the thread here and also check post #23.

    Maybe you have the same issue?

    Can't run .bat files
    Perhaps I'm reading Joshrob1410's original post wrong (quotes below), but I do not think that the cmd.exe file is on his computer. He deleted it. He won't be able to open an elevated command prompt as mentioned in post #23 in the thread that you linked to.

    I cannot be positive that the "it" in "removed it" refers to the cmd.exe file or privileges in the preceding sentence. If "it" refers to privileges, then "it" should have been "them". Either the cmd.exe file was removed/deleted from the computer or the privileges were changed in such a way that the user cannot get to the cmd.exe file.
    Joshrob1410 said:
    A while ago on my laptop I was messing around with the privilages with cmd. I stupidly deleted and removed it. Don't ask why. So now when I go "Run" and search "cmd" it cannot find it. At the same time this happened I was not able to run .bat files. It comes up with "Windows cannot find (the path). Make sure you typed the name correctly then try again". This happens when I click or search for a .bat file. I'm cluess on the problem of how to fix it and would appreciate some helpful advise. Thank you.
    I deleted the cmd.exe file from a virtual machine and then tried to run a BAT file. Windows does indeed throw a misleading error about not being able to find the path to the BAT file. Which is stupid, because Process Monitor shows that Explorer found the BAT file just fine - then passed it to the OS to be opened with the default app. (In this case, the missing cmd.exe file.)

    The virtual machine that I was testing in had a restore point. I used that to get the missing cmd.exe file back. There are other ways to put that file back, but a restore point might be the easiest way.
      My Computer


  5. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #5

    I guess I should have read a little more thoroughly as I seem to have missed the "deleted cmd.exe" part of the original post!

      My Computer


  6. Posts : 10,485
    W7 Pro SP1 64bit
       #6

    That is nothing. Even after interpreting the original post as saying the cmd.exe was deleted; I started to suggest SFC /SCANNOW

    DOH!
      My Computer


  7. Posts : 2
    Windows 7 64 bit
    Thread Starter
       #7

    I have deleted cmd completely. I removed it from the recycling bin and have looked for ways to get it back but can't seem to do so. I have however sent an email to someone containing an attachment with a .bat file. I saved the file and "run" it. It worked except when I try to run a .bat file from the desktop it still comes up with the error message. I cannot do a system restore as when I try to it always fails.
      My Computer


  8. Posts : 10,485
    W7 Pro SP1 64bit
       #8

    You probably did not delete cmd.exe from your hard drive.

    You probably only deleted the hard link to CDM.EXE.

    The hard link resides in C:\Windows\System32\

    System will not run .bat files-cmd-hard-link.png

    Let's wait for those smarted than me to help you correctly recreate that hard link - with all of the correct NTFS permissions.
      My Computer


  9. Posts : 5,656
    Windows 7 Ultimate x64 SP1
       #9

    The one in System32 is a hardlink? :)

    There is also a 32-bit version under C:\Windows\SysWOW64, maybe you can use it
      My Computer


  10. Posts : 10,485
    W7 Pro SP1 64bit
       #10

    GokAy said:
    The one in System32 is a hardlink? :)...
    Yes.

    From here:
    Don't Trust All Your Eyes Tell You... (hard links in Windows Vista) - if (ms) blog++; - Site Home - TechNet Blogs
    When do we use hard links?
    Most of the contents of %systemroot%\System32 is actually hard links to files in folders under %systemroot%\winsxs - the "Side-By-Side" component store.

    This basically means if you view the properties of the %systemroot% folder, you can pretty much subtract the size of the %systemroot%\System32 folder to get a more accurate total size.

    On a side-note, details on the winsxs folder can be found here, along with the reasoning for its size:
    What is the WINSXS directory in Windows 2008 and Windows Vista and why is it so large? - Ask the Core Team - Site Home - TechNet Blogs
    Typo: "Most of the contents of %systemroot%\System32 are actually hard links..."



    GokAy said:
    There is also a 32-bit version under C:\Windows\SysWOW64, maybe you can use it
    It won't run SFC on a 64bit system. Did you have something else in mind?

    The long path that I show in the cmd screenshot is the actual 64bit cmd.exe file. It will run SFC on a 64bit system and that will fix the hard link that was deleted. I'm just not sure if SFC is the best way to handle this. Maybe others can chime in.
      My Computer


 
Page 1 of 2 12 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 18:26.
Find Us