Code:

shell '%comspec% /c "dir C: > C:\ndit.txt"'


does work for me. Make sure that you have permissions to write where you try to write.
_________________________
There are two types of vessels, submarines and targets.