ExecFile problems

Blitz3D Forums/Blitz3D Beginners Area/ExecFile problems

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi all,

I tried to list all running tasks to a textfile.
I'm using WinXp Pro and opened the command prompt (Start menu -> Execute -> cmd)
I tried "tasklist > c:\tasks.txt", which works from there, but if I use this exact line within ExecFile like this:
ExecFile("tasklist > c:\tasks.txt")
the file c:\tasks.txt isn't there.

When I create a .bat file ("c:\CreateTaskList.bat"), which holds the line:
tasklist > c:\tasks.txt
and I do:
ExecFile("c:\CreateTaskList.bat")
it works.

But I wanna do it directly from within Blitz, how can I do it?
I tried setting the command in a variable (string), but that doesn't work also.

a$ = "tasklist > c:\tasks.txt"
ExecFile(a$)

Doesn't work either.

Not even this:

a$ = Chr$(34) + "tasklist > c:\tasks.txt" + Chr$(34)
ExecFile(a$)

Can someone help me with this?
If I try the example from the Blitz docs:
ExecFile("calc.exe")
That works.
Strange.
It seems that it doesn't work when the called command must write something to a file.