There's not a command-line inteface to that that I know of, but proceed with caution. I've had better luck just checking them with the QVW command-line switches. The few times I've used defrag, it caused more problems (if counted by the # of errors in my server logs) than it solved. Sample thread from the community:
I've used this PowerScript code to fix errors (ignoring defrag):
$SharedFiles = ls *.Shared
Foreach($f in $SharedFiles)
C:\temp\SharedFiles\QVS.exe -x "" $f.BaseName "" -v
Start-Sleep -s 10
Checkout the releasenotes 11.2 SR9 (page 59), there is a new tool available for cleaning the Shared files.
15 Shared file Cleaning TOOL
QlikView are pleased to announce that a new shared file Cleaning Tool is now included in the QlikView
Server executable. This will allow system administrators to analyze (verify) and repair (purge) the
QlikView document shared files easily and effectively simply by running a command line execution of
QVS.exe with special parameters. The server administrator will then have the option of using the
purged shared file, or retaining the old shared file.