Question

  • Creator
    Topic
  • #2161627

    Defrag on shutdown with .bat file

    Locked

    by rgun2515 ·

    Anyone running shutdown scripts from Group Policy? “gpedit.msc” – windows settings – scripts – shutdown – add shutdown.bat. My “shutdown.bat” reads.

    cleanmgr /sagerun:11
    defrag -v c:\
    exit

    It is obvious that it runs. Takes a while to finishing “running shutdown scripts”.

    Thing is, If after you boot up the computer and go into windows defrag, it graphically shows the same as it did before,(lots of red) and states “you should defrag this drive”

    Even if you do it from a command line, same results…
    Then I run it with the windows defrag program, and it defrags nicely.

    Is running defrag from the command line really working?

All Answers

  • Author
    Replies
    • #2463214

      Clarifications

      by rgun2515 ·

      In reply to Defrag on shutdown with .bat file

      Clarifications

    • #2463100

      Maybe

      by nimmo ·

      In reply to Defrag on shutdown with .bat file

      Try adding the -w flag and see what happens, if its a shutdown script I dont see the need for verbose mode to be enabled so I’d remove that once the script is working properly.

      Also you may want to try running it without the cleanup manager to see if thats whats holding the script up.

    • #2463092

      RE: Is running defrag from the command line really working?

      by rob miners ·

      In reply to Defrag on shutdown with .bat file

      No its not.
      You have the wrong syntax defrag -v c:\

      Try it this way defrag c: -v or better still defrag c: -f

      < trying to time sinc >

Viewing 2 reply threads