Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Automatic chkdsk?


  • Please log in to reply
10 replies to this topic

#1 Shandley

Shandley

  • Members
  • 166 posts
  • OFFLINE
  •  
  • Local time:12:38 AM

Posted 22 June 2009 - 03:44 PM

Greetings!

I am setting up a batch file which will copy a log when a chkdsk has been performed automatically. Now, I have it all set with the scheduler but I cannot get it to automatically say Yes (Y) when it asks:

Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)


Any ideas?

Edited by Shandley, 22 June 2009 - 04:12 PM.


BC AdBot (Login to Remove)

 


#2 hamluis

hamluis

    Moderator


  • Moderator
  • 55,248 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Killeen, TX
  • Local time:03:38 AM

Posted 22 June 2009 - 04:07 PM

FWIW: ....there is already a log made when chkdsk runs, maintained in the Event Viewer files.

http://forums.techarena.in/windows-xp-support/866643.htm

I have no idea what you are trying to do, but suggest you take a look at http://www.google.com/search?hl=en&rls...log&aqi=g10

Louis

#3 Shandley

Shandley
  • Topic Starter

  • Members
  • 166 posts
  • OFFLINE
  •  
  • Local time:12:38 AM

Posted 22 June 2009 - 04:12 PM

I am not looking how to make or get a log file. I am looking how to automatically tell chkdsk that I want it to start when the computer restarts, automatically as said above.

Edited by Shandley, 22 June 2009 - 04:13 PM.


#4 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,250 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:01:38 AM

Posted 22 June 2009 - 04:28 PM

echo Y | chkdsk C:

echo Y merely causes the command interpreter to print Y.
| is a pipe, which redirects the output from one command (echo in this case) to the input of another command (chkdsk in this case)
chkdsk C: as you know runs chkdsk against the C: drive. You may include the /r option for a more thorough check.


Note: the pipe (|) can be typed by pressing Shift then the backslash key on most keyboards:
Posted Image

Edited by Amazing Andrew, 22 June 2009 - 04:30 PM.


#5 Shandley

Shandley
  • Topic Starter

  • Members
  • 166 posts
  • OFFLINE
  •  
  • Local time:12:38 AM

Posted 22 June 2009 - 04:34 PM

Thank you for the reply. I did try this but It showed this:

Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)
Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)
Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)


After it's done it brings me to the prompt (i couldn't press Y or N).. and it did not go into chkdsk when I rebooted.

Edited by Shandley, 22 June 2009 - 04:35 PM.


#6 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,250 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:01:38 AM

Posted 22 June 2009 - 04:39 PM

That's odd. Works just fine for me.

#7 Shandley

Shandley
  • Topic Starter

  • Members
  • 166 posts
  • OFFLINE
  •  
  • Local time:12:38 AM

Posted 22 June 2009 - 05:02 PM

I totally forgot to mention that I am using an AT command so it will run automatically.

ie: AT \\computernamehere 00:01 /Interactive /every:s echo Y | chkdsk C: /f /r



... of course the computernamehere is replaced with the proper computer name.

Edited by Shandley, 22 June 2009 - 05:02 PM.


#8 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,250 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:01:38 AM

Posted 22 June 2009 - 05:22 PM

Try:

AT \\computernamehere 00:01 /Interactive /every:s goto label1
:label1
echo Y | chkdsk C: /r


#9 Shandley

Shandley
  • Topic Starter

  • Members
  • 166 posts
  • OFFLINE
  •  
  • Local time:12:38 AM

Posted 23 June 2009 - 09:41 AM

That works GREAT! I am wondering if you know of a way to use the shutdown.exe in the same batch of commands to restart the computer after that. Another AT command perhaps?

Right now I am trying to do something like this.

AT \\name 03:01 /Interactive /every:s goto label1
:label1
echo Y | chkdsk C: /r
AT \\name 03:02 /Interactive /every:s %windir%\system32\shutdown.exe -r -t 01

I am not at the computer I wish to do this at so I cannot try it right now. Would this work?

#10 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,250 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:01:38 AM

Posted 23 June 2009 - 11:48 AM

It ought to.

Just a thought: Since the shutdown.exe program is in Windows' PATH variable, there is no need to include the full path. Just invoke shutdown.exe and Windows ought to find it easily.

#11 Shandley

Shandley
  • Topic Starter

  • Members
  • 166 posts
  • OFFLINE
  •  
  • Local time:12:38 AM

Posted 23 June 2009 - 11:50 AM

Thanks Amazing Andrew!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users