Re: reg.exe help please
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Sun, 23 Mar 2008 08:08:36 +0100
"ecellis" <ecellis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BCD7F0BE-AD97-43A4-8F2C-994E1D9FB057@xxxxxxxxxxxxxxxx
Hello, I know this is a wierd request but here it goes... I need to have
1
batch file that does the following:
1) runs chkdsk next time the system restarts
2) add a registry string value to the "runonce" key that will run
"defrag.exe"
I am having problems with number 2. Here is what I wrote and why it isn't
working:
reg add hkcu\software\microsoft\windows\currentversion\runonce /v defrag
/t
reg_sz /d c:\windows\batfiles\defrag.exe c: -f /f
The problem is that defrag.exe needs the "c:" and I would like to have the
"-f" to force it to defrag even if the free drive space gets low. Since
there is a space between defrag.exe and "c" (I don't know if the ":" is
also
causing a problem) the reg.exe program is getting messed up and gives an
error stating "Too many command-line parameters." The next /f is for
reg.exe
to force overwriting the existing registry entry without prompting.
I made sure that the rest of the command was right by deleting the "c: -f"
from the end of the command. It made the string value registry entry
called
"defrag" with the value "defrag.exe"
I need to keep this as 1 bat file and no other files (no .reg, txt, or
other
file). This is something I am making for a friend and he's going to put
it
on all his business computers. I'm pretty sure that it is a lot of
computers
and his reasoning is that this batch file is going to be put on everyone's
desktop. He doesn't want to have to go to each computer and copy one file
to
the desktop and another into the windows directory (or anywhere else), or
have an extra file on the desktop annoying people. It would take him
longer
and it is easier to deal with just one file if things get messed up.
So how can I get the path and command switch to be able to be entered with
the reg.exe program?
I told him to just schedule a defrag but he wants to be sure to run chkdsk
first and then defrag. He can schedule the bat file, have it restart, run
chkdsk, then defrag the drive overnight instead of waiting for chkdsk to
do
it's job and then manually running defrag before leaving for the night.
Thanks for your help! It's been a long time since I worked in a DOS type
(ok somewhat DOS type hahaha) environment. I'm sure there has got to be
something simple that I am over looking.
Thanks,
Eric
There is no need to hack the registry to do this. All he needs is this:
1. Schedule Job #1 to perform a chkdsk at the desired time.
He can do this with this batch file:
@echo off
echo Y | chkdsk c: /f
echo %date% %time% > c:\chkdsk.log
2. Schedule Job #2 to perform a defrag at boot time:
@echo off
if not exist c:\chkdsk.log goto :eof
del c:\chkdsk.log
defrag /.. /..
The above batch files should work but are untested.
You could use schtasks.exe to schedule the jobs centrally,
without going to each machine.
Personally I think your friend is wasting his time with his
frequent defrags. He won't notice any difference whatsoever
in performce but he risks losing a machine if a power failure
occurs in the middle of a defrag.
.
- Follow-Ups:
- Re: reg.exe help please
- From: ecellis
- Re: reg.exe help please
- From: ecellis
- Re: reg.exe help please
- Prev by Date: Re: will not boot because of atisgkaf.sys problems
- Next by Date: Re: How do you find out with model a laptop is?
- Previous by thread: RMUSetup
- Next by thread: Re: reg.exe help please
- Index(es):
Relevant Pages
|
Loading