Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: System will not run .bat files

24 Jul 2015   #1
Joshrob1410

Windows 7 64 bit
 
 
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 System SpecsSystem Spec
.
24 Jul 2015   #2
UsernameIssues

W7 Pro SP1 64bit
 
 

My testing inside of a virtual machine indicates that these steps should work for you:
System Restore
My System SpecsSystem Spec
24 Jul 2015   #3
Callender

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

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 System SpecsSystem Spec
.

24 Jul 2015   #4
UsernameIssues

W7 Pro SP1 64bit
 
 

Quote   Quote: Originally Posted by Callender View Post
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.
Quote   Quote: Originally Posted by Joshrob1410 View Post
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 System SpecsSystem Spec
24 Jul 2015   #5
Callender

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

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 System SpecsSystem Spec
24 Jul 2015   #6
UsernameIssues

W7 Pro SP1 64bit
 
 

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

DOH!
My System SpecsSystem Spec
24 Jul 2015   #7
Joshrob1410

Windows 7 64 bit
 
 

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 System SpecsSystem Spec
24 Jul 2015   #8
UsernameIssues

W7 Pro SP1 64bit
 
 

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 System SpecsSystem Spec
25 Jul 2015   #9
GokAy

Windows 7 Ultimate x64 SP1
 
 

The one in System32 is a hardlink?

There is also a 32-bit version under C:\Windows\SysWOW64, maybe you can use it
My System SpecsSystem Spec
25 Jul 2015   #10
UsernameIssues

W7 Pro SP1 64bit
 
 

Quote   Quote: Originally Posted by GokAy View Post
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
Quote:
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..."



Quote   Quote: Originally Posted by GokAy View Post
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 System SpecsSystem Spec
Reply

 System will not run .bat files




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Cannot force system to use my modified system files...
I am using 64-bit version, and there is a problem. I want to change watermark text on desktop (right, down corner of screen). It is possible by changing user32.dll.mui in resource editor. I edited 32 and 64-bit file in WOW64 and System32 folder, but text on screen is same. Nothing changed... I...
Customization
How restore system files when System File Checker won't work
I have run System File Checker (sfc) and it found many files that were corrupt and could not be repaired. My PC appears to be running fine - but I am anal about repairing anything that is wrong on my PC. The only suggestion I've received so far was to perform a Repair Install. That's very risky....
Performance & Maintenance
When to delete old files and create System Image after System Repair
I have just finished a System Repair on my Windows 7 using repair ISO, and I'm not sure if I should do a system image backup before deleting old files with Disk Cleanup, or delete them after I've done a Repair Disc and System Image as well. I'm also afraid to delete anything at this stage. Would...
Backup and Restore
Can't Clear System Restore Files. System Check Virus the Cause?
About a month ago I managed to get the infamous System Check virus on my computer. I was shocked that it happened, I was at the time doing a google image search. Anyway I managed to remove the virus, unhide my files, and restore all my start menu shortcuts. During the removal process, I...
General Discussion
Files are listed by Carbonite as system files after adding tag
I'm running Windows 7 Professional 64-bit and having the same problem. You can easily resolve the "Hidden File" problem by right clicking on the file, select Properties, and remove the check box next to "Hidden". If you tagged all the photos in a folder, simply select all (ctrl-A) and do the same....
Software
Why Backup user and system files fails to create system images to optical disc?
1. Open center 2. Set backup settings and Select a optical disc as the location to save backup 3. An informaion pops up, says "System images cannot be saved on this device" Click for help, and can find "you can't save a system images on a CD or DVD" So, my question is why we can't do it,...
Backup and Restore


Our Sites

Site Links

About Us

Find 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 21:06.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App