Question

Locked

Defrag on shutdown with .bat file

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?

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Maybe

by Nimmo In reply to Defrag on shutdown with . ...

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.

Collapse -

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

by Jacky Howe In reply to Defrag on shutdown with . ...

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 >

Back to Hardware Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums