C
C
Chvalov2015-12-09 15:17:35
Perl
Chvalov, 2015-12-09 15:17:35

How to write to the log the output of a perl script run on the Windows command line?

There is a PERL script in which, unfortunately, there is no output of messages to the log.
I tried to run the waters like this perl script.pl -host ya.ru >out.txt
. But as soon as I added >out.txt, the script does not start.
Tell me what options are there to write everything to a file occurring on the command line, or maybe there is some kind of terminal that supports output to a file?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2015-12-09
@saboteur_kiev

Redirecting to a file should work exactly as you indicated.
On the other hand, you can bring a piece of code from a perl script in which the output occurs. Maybe the script does not initially output to stdout?

A
Alexander Nikitin, 2015-12-09
@padla2k

put this in the script.cmd file:
perl script.pl -host ya.ru
and then from the command line run script.cmd >out.txt
If your script correctly writes to stdout, then all this will fall into out.txt

D
dionys, 2015-12-17
@dionys

perl script.pl -host ya.ru > out.txt 2>&1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question