select test-file assign to "-P %TMP% cmd /c dir *.* > %TMP%"
If your applications use this syntax, you should remove it from your SELECT statements.
For more information on the pipes that are supported, read Programming > File Handling > File Handling Guide > Filenames > Setting Up Pipes.