filtrationproducts
asked on
Bat file command to run CHKDSK
I had a .bat file that I used to run a chkdsk and defrag after the completion of a backup. For some reason that file is missing and I did not create a back up of it. I have the defrag part completed below. But I cannot get the chkdsk command part to work.
I have tried
chkdsk e: /f
chkdsk e: /x
When I run the bat file with either of these the bat file opens a command prompt and it just loops at the chkdsk command. Does anyone know the syntax to get chkdsk to scan from a bat file?
(FYI - I cannot use windows scheduler, this needs to run through a backup program linked to the bat file)
I have tried
chkdsk e: /f
chkdsk e: /x
When I run the bat file with either of these the bat file opens a command prompt and it just loops at the chkdsk command. Does anyone know the syntax to get chkdsk to scan from a bat file?
(FYI - I cannot use windows scheduler, this needs to run through a backup program linked to the bat file)
echo
<<chkdsk command to go here>>
defrag e:
pause
ASKER
That does not work either, that also just makes it loop and scroll at the chkdsk command.
I know this is possible. I had this setup for 2 years and it worked perfectly. I remember it was a very simple command.
I know this is possible. I had this setup for 2 years and it worked perfectly. I remember it was a very simple command.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you call it either
chkdsk.cmd or defrag.cmd? If so it will be re-runnin itself ahead of the exe.
Steve
chkdsk.cmd or defrag.cmd? If so it will be re-runnin itself ahead of the exe.
Steve
ASKER
This was the command. I tried it on my XP workstation and it worked fine. But on the Windows 2003 SBS server I had to change to the c:\windows\system32 directory before running the chkdsk command. Once I added "cd c:\windows\system32" right before the chkdsk command it began working.
Curious but did that stop it looping, or did you just mean it was pausing for a "Yes" to dismount the volume - /X should do that?
Steve
Steve
ASKER
No, it wasn't pausing for a Yes to dismount the volume. I think it was looping because it couldn't find the chkdsk.exe file. Once I changed directories the looping stopped. I also did add a /x to dismount. It ran last night and was sitting at the "Yes/No" prompt this morning.
http://www.appdeploy.com/messageboards/tm.asp?m=22945&mpage=1&key=妡