如何在计划任务中使用Windows2000自带的磁盘碎片整理程序?

Kendiv 2003-02-27 01:02:27
如何设置计划任务,可以让磁盘碎片整理程序按计划自动运行,进行磁盘碎片整理?
...全文
219 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
HarryFishPotter 2003-09-26
  • 打赏
  • 举报
回复
我也想知道。很不方便,在国外一个网站找到的办法是
Save this as defrag.vbs

'This script launches defrag and sends keys to the UI in order to automate the defrag
'process.

set WshShell = CreateObject("WScript.Shell")

'Launch Defrag from the command line and wait for a second
WshShell.Run "dfrg.msc"
WScript.Sleep 1000

'Wait until the application has loaded - Check every second
While WshShell.AppActivate("Disk Defragmenter") = FALSE
wscript.sleep 1000
Wend

'Bring the application to the foreground
WshShell.AppActivate "Disk Defragmenter"
WScript.Sleep 200

'Send an ALT-A key to bring down the degrag menu
WshShell.SendKeys "%A"
WScript.Sleep 200

'Send a D to start the defrag
WshShell.SendKeys "D"

'Wait until the defrag is completed - Check for window every 5 seconds
While WshShell.AppActivate("Defragmentation Complete") = FALSE
wscript.sleep 5000
Wend

'Bring the msgbox to the foreground
WshShell.AppActivate "Defragmentation Complete"
WScript.Sleep 200

'Send a tab key to move the focus from View Report button to the Close Button
WshShell.Sendkeys "{TAB}"
Wscript.Sleep 500

'Send key to Close the Defragmentation Complete window
WshShell.Sendkeys "{ENTER}"
Wscript.Sleep 500

'Send and ALT-F4 to Close the Defrag program
WshShell.Sendkeys "%{F4}"

-Schedule it in task scheduler.
Kendiv 2003-02-27
  • 打赏
  • 举报
回复
可不能指定整理那几个分区或者磁盘啊, 我设置完之后,到了指定时间只是打开了磁盘碎片整理,并不会自动开始整理磁盘啊,而且,也不指定整理那个磁盘或者分区。

dfrg.msc --- 打开磁盘碎片整理的控制台

不能在命令行下直接调用:
dfrgntfs.exe
dfrgfat.exe

怎样让磁盘整理自动开始呢?
jiangshi99 2003-02-27
  • 打赏
  • 举报
回复
直接就可以设置啊?有什么问题?!
yaos 2003-02-27
  • 打赏
  • 举报
回复
计划任务中有相应的设置

6,849

社区成员

发帖
与我相关
我的任务
社区描述
Windows 2016/2012/2008/2003/2000/NT
社区管理员
  • Windows Server社区
  • qishine
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧