使用windows任务计划定时进行磁盘碎片整理

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/iteye_6683/article/details/81991633
1、控制面板->任务计划->添加任务计划。
2、选择要运行的程序:C:\WINDOWS\system32\defrag.exe。
3、设置任务名称,选择执行周期【每天】。
4、设置起始时间和起始日期,运行这个任务选择【每天】。
5、设置执行任务计划的用户/密码。
6、选择【在单击完成时,打开此任务的高级属性。】,单击完成。
7、在任务页面,修改运行内容:C:\WINDOWS\system32\defrag.exe e: -f。
8、在设置界面,勾选【如超出XX小时XX分钟后停止任务】,同时,设置时间。
9、点击应用,OK了。
展开阅读全文

[原创]在WINDOWS XP下进行计划磁盘碎片整理

07-05

http://blog.csdn.net/scz123/archive/2005/07/05/414417.aspxrnrnrn  在WINDOWS XP/2003系统里,提供了一命令行模式工作的碎片整理工具: defrag.exe,文件位与WINDOWS\SYSTEM32目录下。rnrnc:\windows\system32>defrag /?rn用法:rndefrag [-a] [-f] [-v] [-?]rn volume 驱动器号或装载点(d: 或 d:\vol\mountpoint)rn -a 只分析rn -f 即使可用空间不足,也强制碎片整理rn -v 详述结果rn -? 显示这段帮助文字rnrn  那么,我们可以运行 defrag c: -f 就可以对C盘进行碎片整理了。再利用任务计划(控制面板->任务计划,当然前提要求 Task Scheduler 服务要正常运行),根据向导添加碎片整理的计划了。rn1、添加计划,指定文件为windows\system32\defrag.exern2、使用有管理员权限的的用户执行计划,如administrator用户。rn3、修改添加好的任务,修改执行的命令为c:\windows\system32\defrag.exe c: -frnrn  同样的方法,我们可以建立多个任务,对多个硬盘进行碎片整理,如周一中午的时候整理C盘、周二中午整理D盘……rnrn  对于非管理员权限的用户,默认情况下不能执行磁盘碎片整理。在XP下,我们可以通过策略组修改,使非管理员权限得到碎片管理的权限:rn1、在管理员情况下运行gpedit.mscrn2、展开:计算机配置->Windows设置->安全设置->本地策略->用户权利指派rn3、找到“ 执行卷维护计划”,可以发现已经有administrators组,说明在Administrators组里的用户都可以进行卷维护,那么我们只要添加允许的用户就可以了,如power users组。rnrn添加了权限的用户可以进行磁盘整理、磁盘扫描的工作,但同时,用户也可以进行卷的卸载等管理,所以对某些用户来说,就有丢数据的危险,呵呵rnrn非常可惜的是,WINDOWS 2000没有defrag.exe,而且xp的不能直接拷贝到2000下使用,而且组策略里也没有“ 执行卷维护计划”的权利指派。rnrn  在网上搜索了以下,有很多工具可以进行碎片整理。推荐一款:PerfectDisk 7.0 http://www.raxco.com/products/perfectdisk2k/rn该软件可以进行本地磁盘整理和Exchange整理,而且可以进行远程磁盘整理,更值得一提的是,设置为单机版后,就可以让非管理员进行磁盘整理。另外,该软件提供了计划管理功能。虽然软件的界面简单明了,软件还是提供了详细的帮助,不过是英文的。相信这个软件对大家会有所帮助。rnrnrn 论坛

磁盘碎片整理算法

08-14

这个是我昨天在topcoder(googlejam) 练习室看道的一道算法题,我昨天想了一天rn最后得出一个结论:我想出了一个笨方法,但是不可以用(复杂度为m的n次方),简直rn是天文数字,所以我做不出来,原题如下,希望大家能提供一些资料,给点提示.rn执行不能超过2秒!rnrnProblem Statementrn rnWhen files are stored on a hard disk, they often become fragmented. This means that the file is not stored in sequential sectors on the disk. The first half of a file might be stored in sector 243, while the second half of a file might be far away in sector 105. The goal of defragmenting a hard drive is to arrange the files so that each file is stored in order on sequential sectors of the disk. Thus, if a file required 4 sectors of storage space, it would end up in sectors N, N+1, N+2, and N+3, for some N. Typically, this is done to increase the overall speed of the computer. There are a number of programs that will defrag a hard disk as described above. However, many of them are painfully slow. You are trying to develop a new algorithm to defrag hard drives, but before you start, you would like to determine how fast you can defrag a very small drive without very many files on it. You will be given the locations of a number of files on a small hard disk, and are to determine the minimum number of sectors that must be moved before the entire drive is defragged. You have enough memory to hold two sectors worth of data at once, but that is all. You will be given a String[], disk, each of whose elements represents a single file. Each element of disk will be formatted as a single-space delimited list of integers which represent the locations of the parts of the file, in order. Hence, the String, "4 9 6 59 41" represents a file stored in 5 sectors where the first part of the file is in sector 4 of the disk. One way to defrag this file would be to move the contents of sector 9 to sector 5, the contents of sector 59 to sector 7, and the contents of sector 41 to sector 8. By doing this, the file would be stored sequentially in sectors 4-8. You will also be given an int, size, representing the total number of sectors on the disk (sectors 0 through size-1, inclusive, may contain data). You are to return the smallest number of sectors that must be moved to defragment the whole disk. Keep in mind that you can not move data to a sector until any data being stored there is moved.rnDefinitionrn rnClass:rnDiskDefragrnMethod:rnminMovesrnParameters:rnString[], intrnReturns:rnintrnMethod signature:rnint minMoves(String[] disk, int size)rn(be sure your method is public)rn rnrnConstraintsrn-rnsize will be between 10 and 100, inclusive.rn-rndisk will contain between 1 and 12 elements, inclusive.rn-rnEach element of disk will contain between 1 and 50 characters, inclusive.rn-rnEach element of disk will be a single-space delimited list of integers, without extraneous leading zeros.rn-rnEach integer in disk will be between 0 and size-1, inclusive.rn-rnNo integer will be appear more than once in disk.rnExamplesrn0)rnrn rn"3 4 5 6 8 9 10","17 16 15"rn20rnReturns: 5rnWe can defrag the first file by moving the contents of sector 8 to sector 7, then 9 to 8, and finally 10 to 9. The second file can be defragged in a number of ways by moving the contents of two sectors, for a total of 5.rn1)rnrn rn"1 2 3 5 4 6 7 8"rn10rnReturns: 2rnHere we can take advantage of the fact that we have enough memory to hold two sectors worth of data. First, load the contents of sectors 4 and 5 into memory. Now, simply write the data back in the reverse order.rn2)rnrn rn"1 3 5 7","0 2 4 8","6 9"rn100rnReturns: 7rnrnThis problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved. 论坛

没有更多推荐了,返回首页