mark4444az has asked for the wisdom of the Perl Monks concerning the following question:

I am running a .exe file in perl(i am able to do this with the "system" command). I also want to print the results of the .exe to a text file, I am not sure how to do this. When the executable runs it prints data to the command line window, is there some way to get it to print to a file?
  • Comment on Outputting results of an exe to a text file

Replies are listed 'Best First'.
Re: Outputting results of an exe to a text file
by fidesachates (Monk) on Apr 12, 2011 at 20:22 UTC
    Like a *nix system, windows understands the > redirector. Add the "> text.txt" to the end of your command and the output will end up there.

    Make sure you have paths set properly or use absolute paths.

    Another solution is to call the exe in perl with backticks thus capturing the output into the perl script and then print the array into a file.