Author Topic: Defragment  (Read 42764 times)

0 Members and 1 Guest are viewing this topic.

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Defragment
« on: October 29, 2012, 12:56:12 pm »
Hey Guys

  Looking for a way to completely defrag my drives without using third party defragmenters. I read somewhere that -w switch is not supported in windows 7. Is this true? Normally I use "defrag c: -v -w".


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #1 on: October 29, 2012, 01:14:55 pm »
Put this in a bat file :wink:

start /wait %SYSTEMDRIVE%\Windows\System32\defrag.exe C: /H /V
start /wait %SYSTEMDRIVE%\Windows\System32\defrag.exe C: /H /V /X

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #2 on: October 29, 2012, 01:20:55 pm »
What do these do and how do I put into a bat file?


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #3 on: October 29, 2012, 01:45:58 pm »
Here is mine I run before I head to bed. :wink:

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #4 on: October 29, 2012, 01:46:15 pm »
Will this do all drives at once?
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #5 on: October 29, 2012, 01:47:19 pm »
Just the C: drive. If you want to add other drives you do it like this, you will see D: is added

start /wait %SYSTEMDRIVE%\Windows\System32\defrag.exe C: D: /H /V
start /wait %SYSTEMDRIVE%\Windows\System32\defrag.exe C: D: /H /V /X

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #6 on: October 29, 2012, 01:49:37 pm »
Thanks for that. Right when you sent it I figured out how to make bat file. It was easier than I thought. Good to know.


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #7 on: October 29, 2012, 01:54:58 pm »
Wooo I got this.


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #8 on: October 29, 2012, 01:57:10 pm »
I bet you have UAC enabled, right click on the bat file and click run as administrator :wink:

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #9 on: October 29, 2012, 02:00:28 pm »
I have it off. Ill try as administrator. I checked and it is there.


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #10 on: October 29, 2012, 02:02:10 pm »
Nope, same thing...uhhmm.


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #11 on: October 29, 2012, 02:03:59 pm »
Normal defrag works from gui


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #12 on: October 29, 2012, 02:06:10 pm »
Very odd. Can you run it from a cmd window your self?

Also try this in the bat file

start /wait %SYSTEMDRIVE%\Windows\System32\defrag.exe C: /H /V
start /wait %SYSTEMDRIVE%\Windows\System32\defrag.exe C: /H /V /X

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #13 on: October 29, 2012, 02:10:14 pm »
yep
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #14 on: October 29, 2012, 02:12:37 pm »
OK so you can run defrag from cmd manually.

Try this, move the bat file to the root of the C: drive and try it.

I notice where you are running the bat file that there is a space in the path. That might be getting in the way.

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #15 on: October 29, 2012, 02:19:32 pm »
Same thing


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #16 on: October 29, 2012, 02:22:39 pm »
what the crap lol. I wonder if something is blocking the bat file?

Here is a way to test. Open a cmd.exe window and past this in

start /wait %SYSTEMDRIVE%\Windows\System32\defrag.exe C: /H /V

Does it work?

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #17 on: October 29, 2012, 02:25:33 pm »
Yep works fine
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #18 on: October 29, 2012, 02:29:23 pm »
Then something is blocking the bat file. What AV do you have installed?

I know Avast has a sandbox mode (Which I disable)

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #19 on: October 29, 2012, 02:31:56 pm »
avast but it doesn't show sandbox blocking. ill trun it off and try


Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #20 on: October 29, 2012, 02:34:02 pm »
Same thing
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #21 on: October 29, 2012, 02:36:04 pm »
Try disabling avast all together and any other protection you have and see.

Very odd something is blocking the bat file.

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #22 on: October 29, 2012, 02:38:48 pm »
I can run other bat files. I recently had diskeeper installed (realized i don't need it). could that be the problem

Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Defragment
« Reply #23 on: October 29, 2012, 02:51:07 pm »
Dont see why it would be. You can run the commands from a cmd window but not from a bat file.

Not sure what is going on there. It is like the bat file doesnt have permission to access the system32 dir.

Shane

Offline chris635

  • Sr. Member
  • ****
  • Join Date: Nov 2011
  • Posts: 442
  • Location: USA
  • Karma: 11
    • View Profile
Re: Defragment
« Reply #24 on: October 29, 2012, 02:52:14 pm »
Curious for sure. My system runs perfect other wise

Chris
Physical Science Technician
Avid Motorcyclist

Have a nice day - Chris