Re: reg.exe help please




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


.



Relevant Pages

  • Re: reg.exe help please
    ... "-f" to force it to defrag even if the free drive space gets low. ... to force overwriting the existing registry entry without prompting. ... and his reasoning is that this batch file is going to be put on everyone's ... I told him to just schedule a defrag but he wants to be sure to run chkdsk ...
    (microsoft.public.windowsxp.general)
  • Re: Whats teh Fastest Defragger their is ???
    ... create a batch file to run defrag ... start /wait chkdsk C: /f ... > But are their any faster ones like 0@0 Defrag, Perfect disk ect? ...
    (microsoft.public.windowsxp.help_and_support)
  • XP keeps hanging - update
    ... I have tried chkdsk from 'my computer' right click etc and selected both ... still using the registry during log off. ... This is often caused by services running as a user account, ... >> Have tried safe mode and going back to a restore point. ...
    (microsoft.public.windows.mediacenter)
  • Re: System Mechanic?
    ... I'm a bit old school with the whole registry thing. ... delete duplicate files. ... It even has boot-time defrag of the MFT, ... You can do things like scrub your drive and securely erase data. ...
    (microsoft.public.windowsxp.general)
  • Re: System Mechanic?
    ... I'm a bit old school with the whole registry thing. ... > delete duplicate files. ... It even has boot-time defrag of the ... > You can do things like scrub your drive and securely erase data. ...
    (microsoft.public.windowsxp.general)

Loading