bucketbuster Posted January 15, 2005 Share Posted January 15, 2005 Hi,does anybody know how I run chkdsk and immediately after that a defragmentation program (dirms) before XP starts or when it restarts?I know I can use Task Scheduler to schedule chkdsk at startup, but is it possible to run another program right after?I've read something about GuiRunOnce, but don't understand how to use it I want to make a batchfile that restarts my computer, at start up: 1.scans my harddrives for errors and fixes them,2.defrags my harddrives, (3. runs pagedefrag) and after that starts XP.EDIT:Finally figured it out Look here: http://www.msfn.org/board/index.php?showto...10entry254706 Link to comment Share on other sites More sharing options...
oftentired Posted January 15, 2005 Share Posted January 15, 2005 I suppose one way to do it is to place each command in a separate hive or registry key which windows reads sequentially during startup. This is the sequential list in the order they are processed:• BootExecuteHKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute • Services • User enters a password and logon to the system • UserInitHKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserInit • ShellHKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell • All Users-RunOnceHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce • All Users-RunHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run • All Users-RunOnceExHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx • All Users-RunExHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunEx • Current User-RunOnceHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce • Current User-RunHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run • Current User-RunOnceExHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnceEx • Current User-RunExHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunEx • Common Startup Folder • Startup FolderThe list came from this webpage http://www.greatis.com/security/startuporder.htmSome information here may prove helpful to you http://www.ntcompatible.com/thread24145-1.html Link to comment Share on other sites More sharing options...
bucketbuster Posted January 15, 2005 Author Share Posted January 15, 2005 Thx,I'm gonna check it out... Link to comment Share on other sites More sharing options...
bucketbuster Posted January 16, 2005 Author Share Posted January 16, 2005 I've figured out how to run chkdsk and pagedefrag from bootexecute.But I still don't get dirms to work.I also tried contig, but with no luck.Can anyone help me? Link to comment Share on other sites More sharing options...
oftentired Posted January 17, 2005 Share Posted January 17, 2005 would it be accurate to say that dirms requires cmd.exe to be running for successful execution which means that cmd.exe is not available when bootexecute is called so a defrag program such as dirms will need to be set later in the boot process when cmd.exe is available. I don't know precisely where that would be. Link to comment Share on other sites More sharing options...
bucketbuster Posted January 17, 2005 Author Share Posted January 17, 2005 would it be accurate to say that dirms requires cmd.exe to be running for successful execution which means that cmd.exe is not available when bootexecute is called so a defrag program such as dirms will need to be set later in the boot process when cmd.exe is available. I don't know precisely where that would be.You are probably right. I'm gonna test some other freeware defraggers (defragNT, PowerDefragmenter), hopefully I can get them to work.Anyways, Thx for your help Link to comment Share on other sites More sharing options...
bucketbuster Posted January 17, 2005 Author Share Posted January 17, 2005 would it be accurate to say that dirms requires cmd.exe to be running for successful execution which means that cmd.exe is not available when bootexecute is called so a defrag program such as dirms will need to be set later in the boot process when cmd.exe is available. I don't know precisely where that would be.You are probably right. I'm gonna test some other freeware defraggers (defragNT, PowerDefragmenter), hopefully I can get them to work.Anyways, Thx for your help No luck with DefragNT/Power Defragmenter Anyone knows how to use UserInit or RunOnce? Link to comment Share on other sites More sharing options...
sixpack Posted January 17, 2005 Share Posted January 17, 2005 edit: removed Link to comment Share on other sites More sharing options...
angel0104 Posted January 18, 2005 Share Posted January 18, 2005 you can use diskeeper 8 or 9. select on change your settings then set a boot time defrag. select your c drive then check the options you want. Link to comment Share on other sites More sharing options...
bucketbuster Posted January 18, 2005 Author Share Posted January 18, 2005 you can use diskeeper 8 or 9. select on change your settings then set a boot time defrag. select your c drive then check the options you want.I know I could use Diskeeper or O&O Defrag or PerfectDisk...But I only wanted to use FREEware and automate the whole proces. Link to comment Share on other sites More sharing options...
bucketbuster Posted January 18, 2005 Author Share Posted January 18, 2005 (edited) I finally figured out how to do it!In the attached zipfile you will find 6 files:dirms.exe - the defragmentation tooldirms.bat - batchfile to call dirms.exe with switchespgdfgsvc.exe - pagedefragoptimize.reg - registryentries needed for chkdsk,pagedefrag and dirmsoptimize2.reg - restores the userinit-sectionoptimize.cmd - batchfile to start the optimization-procesThis is what optimize.cmd does:1.merge optimize.reg into the registry, these items will be added to the bootexecute-section:-chkdsk /F /R (=check C: for errors, repair them and check free space)-pgdfgsvc -o (=defrags only at next boot)1b.this will be added to the userinit-section:-dirms.bat, userinit.exe (=needed to load your shell,DON'T remove it!!)(dirms.bat runs dirms.exe c DEFRAG COMPACT)2.Restarts your computer after 30 seconds, giving you time to save your workOnce the whole proces has finished, XP will be started.Put all files except optimize.cmd in C:\WINDOWS\system32\Put optimize.cmd on your Desktop or whereever you want..NOTE:I only added support for C:Links to the used programs:Dirms: http://www.dirms.com/Pagedefrag: http://www.sysinternals.com/ntw2k/freeware/pagedefrag.shtmlChkdsk: already installed with XPI hope someone finds this as usefull as I doEDIT:Now it should work.Optimize.zip Edited January 18, 2005 by bucketbuster Link to comment Share on other sites More sharing options...
jsawyer1835 Posted March 2, 2005 Share Posted March 2, 2005 something i have found to be very handy and alot better for scheduling a chkdsk and defrag in scheduled tasks. i have included 2 files. 1 doc to explain how to create the VBS file to launch the chkdsk/defrag combo that i run once a month, and the defrag.vbs i use weekly.simply go to scheduled tasks and add new, browse for these files and add, be sure to look at advanced options and put a check in the run olnly if logged on box. youre done.chkdsk_defrag.doc Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted March 17, 2005 Share Posted March 17, 2005 I finally figured out how to do it!In the attached zipfile you will find 6 files:dirms.exe - the defragmentation tooldirms.bat - batchfile to call dirms.exe with switchespgdfgsvc.exe - pagedefragoptimize.reg - registryentries needed for chkdsk,pagedefrag and dirmsoptimize2.reg - restores the userinit-sectionoptimize.cmd - batchfile to start the optimization-procesThis is what optimize.cmd does:1.merge optimize.reg into the registry, these items will be added to the bootexecute-section:-chkdsk /F /R (=check C: for errors, repair them and check free space)-pgdfgsvc -o (=defrags only at next boot)1b.this will be added to the userinit-section:-dirms.bat, userinit.exe (=needed to load your shell,DON'T remove it!!)(dirms.bat runs dirms.exe c DEFRAG COMPACT)2.Restarts your computer after 30 seconds, giving you time to save your workOnce the whole proces has finished, XP will be started.Put all files except optimize.cmd in C:\WINDOWS\system32\Put optimize.cmd on your Desktop or whereever you want..NOTE:I only added support for C:Links to the used programs:Dirms: http://www.dirms.com/Pagedefrag: http://www.sysinternals.com/ntw2k/freeware/pagedefrag.shtmlChkdsk: already installed with XPI hope someone finds this as usefull as I doEDIT:Now it should work.<{POST_SNAPBACK}>I have just downloaded this program, as I thought it to be the perfect addition to my unattended DVD.The problem is that my Virtual Machine now is stuck in an infinite loop...Could this be because I changed the hardcoded windows folder to %windir%?Yup, changing the hardcoded to variables was the problem.It's going along nicely now in VMWare Link to comment Share on other sites More sharing options...
Marsden Posted March 17, 2005 Share Posted March 17, 2005 You get what you pay for... Link to comment Share on other sites More sharing options...
slowofmind Posted December 16, 2009 Share Posted December 16, 2009 (edited) Greetings,I hope someone will read this after so long... anyway here goes...I am using WIN XP Media Center EditionThis is exactly the solution I have been searching for a long time.I have never (manually) edited the registry so I am trying to proceed cautiously.I may also have to modify the files in "optimize.zip"I have a few questions:[1] In the file "optimize.reg" why are the "BootExecute" entries in what appears to be hex?[2] Is it possible to have those entries in plain text?[3] Since "DIRMS" is no longer free, are there any free Command Line Defrag programs which can do a good job?Thanks for any help (from anyone). Edited December 16, 2009 by slowofmind Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now