Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

Disk check, cleanup, and defrag script with results to output file

I would like to write a simple batch file that does a disk check, defrag, and cleanup and write the results to an outupt file on the local computer it is running the maintenance on. I have done some research and found snippets of code (attached) but need it customized so that it will execute and spit the results to an ouput file. Right now, the batch file doesn't run and I don't believe there is any code to write the results to a file. If anybody could help me with this, I would appreciate it.
Utility-Script.txt
0
ITRSupport
Asked:
ITRSupport
  • 2
1 Solution
 
sirbountyCommented:
Not sure about disk check, since normally the system needs to be rebooted because the volume is mounted - unless you're just wanting to view the results...

And cleanup manager is prompted - you'd have to select what you want to clean.
If just temp files, then try this:
chkdsk c: > c:\results.txt
defrag c: -f >> c:\results.txt
echo y|del %temp% >> c:\results.txt
del "%userprofile%\local settings\temp\*.* /q" >> c:\results.txt

Open in new window

0
 
ITRSupportAuthor Commented:
That worked...thank you very much!
0
 
sirbountyCommented:
Glad I could help - thanx for the grade! :^)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now