Having a problem with running a command line...
I use gawk all the time from a command prompt window - syntax is:
gawk.exe -f [script file] [input file] > [output file]
( the '>' is there to send the output to the output file and overwrite if it already exists, a '>>' can be sent to append - like batch files, etc.)
In a command prompt window:
when I type 'gawk.exe -f test.awk input.txt > output.txt' it works fine
However, in MS, when I use:
Run>gawk.exe -f test.awk input.txt > output.txt
it runs but the output is going to the command prompt window, not getting sent to the output.txt file via the '>'
Testing MS a little further:
Run>cmd.exe /c "gawk.exe -f test.awk input.txt > output.txt" works as it should and sends the output to output.txt
So it seems that the '>' or '>>' symbols are not working right when sent to the command prompt via the Run> command. I've tried compiling this as a 'console app' as well, but same result, it's like the '>' and everything after is getting ignored.
Does anyone know how to get my command line sent properly to the Run> command or am I stuck using the 'cmd.exe /c' method. I would prefer not to have to depend on cmd.exe because these gawk scripts will work on older machines which might have command.com instead.
Thanks for any help.
Run Program> question
Moderators: JRL, Dorian (MJT support)
Redirection is a function performed BY the command processor, so that is why it must be loaded first with the cmd /c (or command /c)
Now you can use the "ComSpec" environmental variable to determine which command processor is available on whatever machine you are running the script on.
Also see this post for my solution on how to read output
from command line programs directly
http://www.mjtnet.com/forum/viewtopic.p ... highlight=
Now you can use the "ComSpec" environmental variable to determine which command processor is available on whatever machine you are running the script on.
Also see this post for my solution on how to read output
from command line programs directly
http://www.mjtnet.com/forum/viewtopic.p ... highlight=