Computing.Net > Forums > Programming > Batch file troubles

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file troubles

Reply to Message Icon

Name: vande
Date: December 9, 2008 at 09:56:03 Pacific
OS: Windows xp, Windows
CPU/Ram: Dell insprion 530
Product: Dell 530
Comment:

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..........



Sponsored Link
Ads by Google

Response Number 1
Name: vande
Date: December 10, 2008 at 04:19:38 Pacific
Reply:

bump........

Learning in progress..........


0

Response Number 2
Name: Holla
Date: December 11, 2008 at 23:25:48 Pacific
Reply:

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.txt

To 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.


0

Response Number 3
Name: vande
Date: December 13, 2008 at 13:29:44 Pacific
Reply:

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.txt

To 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..........


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file troubles

Batch File trouble www.computing.net/answers/programming/batch-file-trouble/18865.html

Batch file command line www.computing.net/answers/programming/batch-file-command-line/12068.html

Batch File: For Command Syntax www.computing.net/answers/programming/batch-file-for-command-syntax/9262.html