Not able to run defrag using batch file?

The following script is saved using batch file, which works well under window XP, but not window 7

I have set my account to be administrator, and still not able to run.

If I run as administrator on this batch file, it works, and would like to know on how to code the batch file running as administrator.

Does anyone have any suggestions?

Thanks in advance for any suggestions

C:\WINDOWS\system32\defrag.exe

June 30th, 2013 10:05am

As you found out, under Windows 7 you must run this command under elevated privileges because of UAC (User Account Control). Alternatively you could turn off UAC (not recommended). At the same time you should ask yourself why you would want to defrag your disk frequently. Disk caching is now so good that you would not notice any difference in performance, so why bother? Doing it once or twice a year would be plenty. If unsure, use your stop watch to measure a few things.

To pursue this issue further you need to post your question in a general Windows 7 forum. It is not really related to scripting (=programming with scripts).

Free Windows Admin Tool Kit Click here and download it now
June 30th, 2013 12:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics