Windows 版 (精华区)
发信人: cdd (平上), 信区: Windows
标 题: Windows 2000磁盘碎片整理脚本
发信站: 哈工大紫丁香 (2000年07月25日20:37:09 星期二), 站内信件
如果你懒地多动几下手,可以使用以下这段“智能”的碎片整理脚本
它将会自动地整理所有的本地驱动器,而不管他们有几个。将以下这段脚
本保存成 DEFRAG.VBS 文件,就可以手动执行或让计划任务去执行了。这
段脚本来自于 Winmag.com
Dim NumDrives, FSO, Drives, Count
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Drives = FSO.Drives
NumDrives = Drives.Count
NumDrives = NumDrives - NumDrives
Const DriveTypeFixed = 2
Const DriveTypeNetwork = 3
For Each Drive in Drives
If Drive.DriveType = DriveTypeFixed then NumDrives = NumDrives + 1
Next
Set Drives = Nothing
Set FSO = Nothing
set WshShell = CreateObject("WScript.Shell")
WshShell.Run "dfrg.msc"
WScript.Sleep 2000
While WshShell.AppActivate("Disk Defragmenter") = FALSE
wscript.sleep 1000
WshShell.AppActivate "Disk Defragmenter"
Wend
do while (Count <= NumDrives)
wscript.sleep 200
WshShell.SendKeys "%A"
wscript.sleep 200
WshShell.SendKeys "D"
While WshShell.AppActivate("Defragmentation Complete") = FALSE
wscript.sleep 5000
Wend
WshShell.AppActivate "Defragmentation Complete"
wscript.sleep 200
WshShell.Sendkeys "{RIGHT}"
wscript.sleep 200
WshShell.SendKeys "{ENTER}"
wscript.sleep 500
WshShell.Sendkeys "{DOWN}"
Count = Count + 1
loop
WshShell.Sendkeys "%{F4}"
--
问:生活为什么如此美好?
答:因为有了BBS.
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: che.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.824毫秒