Skip to content
⌘ NSIS Forum Archive

Defrag from NSIS

1 posts

dougcvc#

Defrag from NSIS

Hello,

I am trying to use the Microsoft disk defragmenter in an NSIS script i am working on, but even in this simple example It does not work. It just does not seem to launch the defrag executable.

I am sure the command itself is correct as the exact command works from a batch file.
I have also tried exec, execwait, nsexec::exec with no luck.
I am using Windows 7 64 bit.

Here is the example:

Name "defrag"
OutFile "defrag.exe"
RequestExecutionLevel Admin
InstallDir "$TEMP\"
XPStyle on
page instfiles

Section ""

execwait '"c:\windows\system32\chkdsk" C:' #This works
execwait '"c:\windows\system32\defrag.exe" C:\' #This does not

SectionEnd
Many thanks


EDIT:
fixed, i had to include x64.nsh then ${DisableX64FSRedirection}.