Guest jsuknaic Posted January 8, 2004 Share Posted January 8, 2004 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? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2004 Developers Share Posted January 8, 2004 try changing the run statement to: Run, CMD /C C:\\WINNT\\system32\\dfrg.msc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Guest jsuknaic Posted January 8, 2004 Share Posted January 8, 2004 Thank you SOOOO much! That did it. I sincerely appreciate your fast response. Link to comment Share on other sites More sharing options...
Beastmaster Posted January 8, 2004 Share Posted January 8, 2004 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2004 Developers Share Posted January 8, 2004 Don't think it works in Win2K.... There is a utility that helps out called autodefrag http://www.morphasys.com/autodefrag/ SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts