E
ecellis
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
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