Here:
code:
SHELL "%comspec% /c dir /w > c:\test.txt"

Perhaps you meant using a kixtart "dir" or something else, but this is the easy way... just shell to a command prompt to do it. You must use the %comspec% to load the command prompt before running the dir and sending the output to a file.

Brian