Defrag problems in Xojo

I have problems with defrag command in Xojo. Basically I need to save the defrag analysis in txt file when I launch my application. But it doesn’t work. If I put cmd.exe before the defrag c: -v in the Shell.Execute, the shell time out no matter how much time I put.
I was told, using API was good, but I can’t find any.
What should I do ?