Defragmenting Windows Drives as part of an NSIS installer script?

159 views Asked by At

I need to install a piece of software with a lot of files. Our experience showed, that on highly fragmented hard drives that leads to very poor performance. So I want to include automatic disk defragmentation into my installer (which I plan to write using NSIS). How can I include a defrag command and read the results as part of my installer?

1

There are 1 answers

0
jdehaan On BEST ANSWER

I would integrate Jkdefrag (http://kessels.biz/JkDefrag/) in the setup and run it with the command line options to defragment only the directory where you copied the files into.

There are plenty of options and it is open source.

NOTE: It uses the defragmentation API of MS, so it is as safe to use as any other defrag tool. And you have the source if you need to adapt something or change the way the files are sorted.