Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
defrag c: -v -f
echo y|chkdsk /F c:
shutdown -r
The above is my little ameature batch file it will defrag then when finished it will goto next line where it does chkdsk /F for fix sectors but it requires a restart so i pipe in an "echo y" to automate this then simple shut down -r to restart . Now when i am logged in this all works fine. I want to run the script and lock the computer however and it never 100 % completes. Now can someone explain to me what happens when you lock the PC why does this prevent the script from finishing?Also cant i set the .bat file to run under a system account? Thus preventing me from logging in and running this file? Like in the background it will run or something
Learning in progress..........

vande,
My scripts keep running even when the machine is locked.
I have vista, so could not check in xp,
however, I dont think chkdsk is much different anyway.
echo y | chkdsk /f will only echo one y to chkdsk.
Is it possible that chkdsk asks more questions?
like before fixing errors?
if chkdsk asks more questions, and if you know what to answer to those questions,
then you can put those answers in a file and reidrect that file to chkdsk.
for example, you can put
y
y
y
y
y
y
y
in a y.txt file and then do
chkdsk /f c: < y.txtTo answer your other question,
You can schedule to run unattended under system account using the "AT" command.
There is a gui version of "at" called "winat" in resource kit. I think all programs run using at runs under the system account. I am not sure though :-(--
Holla.

vande,
My scripts keep running even when the machine is locked.
I have vista, so could not check in xp,
however, I dont think chkdsk is much different anyway.
echo y | chkdsk /f will only echo one y to chkdsk.
Is it possible that chkdsk asks more questions?
like before fixing errors?
if chkdsk asks more questions, and if you know what to answer to those questions,
then you can put those answers in a file and reidrect that file to chkdsk.
for example, you can put
y
y
y
y
y
y
y
in a y.txt file and then do
chkdsk /f c: < y.txtTo answer your other question,
You can schedule to run unattended under system account using the "AT" command.
There is a gui version of "at" called "winat" in resource kit. I think all programs run using at runs under the system account. I am not sure though :-(Hmm so is the "at" feature a default one understood by windows?
Also I appreciate you telling me how to answer questions by using a .txt file that is very valuable to me, i never knew how that would be done but will it read the .txt file inthe order in which the questions arise? or will it read all "y" at one time?
So can you eloborate a bit more on running that script as a different account? Would i use run as xxxx /PW system name?
something to that nature?Also i run the chkdsk without locking the computer and all goes well so i dont think it is asking any other questions something else is happening where it cant fully complete while locked
Learning in progress..........

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |