Hello, I’m trying to use the dos command echo to output a text file and I’m having a little trouble. I hope you can help me! I’m simply trying the concept out right now and it doesn’t want to work for me. [B)] I’ve tried this SHELL(‘echo hello > c:/myhello.txt’); and it won’t work. It works fine at the command prompt if I type it in that way but it will give me an error in Navision saying that the file echo does not exist. If anyone knows how to create a text file with the SHELL command please let me know. Thanks!
Hi Ian, Try this: SHELL(‘COMMAND.COM’,’/C’,‘myhello.txt’); Best regards Marcel
This is more independent: SHELL(STRSUBSTNO('%1 /c echo hello > c:\myhello.txt', ENVIRON('COMSPEC')));
Regards,
Hi,
I tried to use:
but it kept failling so I tried this:
SHELL(ENVIRON(‘COMSPEC’), ‘/C echo hello > c:\myhello.txt’);
this does the trick. I don’t know whether it’s operating system independent or not.
Another thing, by the way, how can I generate a blank *.txt file: this solution creates a file with “hello” in it? If I replace “echo hello > …” by “echo >…” I get a *.txt file which as written “ECHO is on.”.
Best Regards.