Sign in to follow this  
Followers 0
Guest jsuknaic

Scripting Defrag in Windows 2000

5 posts in this topic

I am new to this tool and I have been trying to script the use of the defrag tool provided in Windows 2000. Below is how the script is written:

Run, %systemroot%\\system32\\dfrg.msc

Winwaitactive, Disk Defrag

Send, {ALTDOWN}A{ALTUP}D

Winwaitactive, Defragmentation Complete

Send, {TAB}{ENTER}

Winwaitactive, Disk Defrag

Send, {ALTDOWN}{F4}{ALTUP}

When I run the script I get an error message that states the following:

Line 1:

Run, C:\\WINNT\\system32\\dfrg.msc

Error: unable to run program. (Ensure that backslashes \ have been used properly).

I have checked the location of the file and all appears well. I can use this command (the first line) to run notepad.exe. I think it may have something to do with executing an .msc file, but I am not sure. Can anyone help me?

Share this post


Link to post
Share on other sites



Thank you SOOOO much! That did it. I sincerely appreciate your fast response.

Share this post


Link to post
Share on other sites

It should be possible to run Defrag completly via the commandline. Please check this link: Defrag Commandline Syntax for additional information.

It could look like this:

Run, %COMSPEC% /C defrag C: /V > C:\defrag.log

Share this post


Link to post
Share on other sites

Don't think it works in Win2K....

There is a utility that helps out called autodefrag http://www.morphasys.com/autodefrag/


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0