vb.netvisual-studiodefragmentation

How can I open Windows Disk Defragmenter


How can I open Windows Disk Defragmenter using vb.net?

I have tried all the "Google" solutions but none seem to work.

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Process.Start("dfrgui.exe")

    End Sub

and...

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Dim sysFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.System)
        Process.Start(sysFolderPath + "\dfrgui.exe")

    End Sub

and...

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Shell("dfrgui.exe")

    End Sub

Solution

  • I guess you compile your code for x86 target systems. Try x64 as target.