command-line output re-direction in winNT 
Author Message
 command-line output re-direction in winNT

perl, version 5.005_03 built for MSWin32-x86-object
WinNT, SP6A

NT cmd.exe window:
  c:> perl fnc.pl arg1 arg2  > outfile

Sends output to outfile.

  c:> fnc.pl arg1 arg2

prints same output on console.

  c:> fnc.pl arg1 arg2  > outfile

Creates outfile, but it's empty.  Any clues as to why would be
appreciated.

Thanks,
George

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.*-*-*.com/ - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



Tue, 10 May 2005 22:05:53 GMT  
 command-line output re-direction in winNT
: perl, version 5.005_03 built for MSWin32-x86-object
: WinNT, SP6A

: NT cmd.exe window:
:   c:> perl fnc.pl arg1 arg2  > outfile

: Sends output to outfile.

:   c:> fnc.pl arg1 arg2

: prints same output on console.

:   c:> fnc.pl arg1 arg2  > outfile

: Creates outfile, but it's empty.  Any clues as to why would be
: appreciated.

I will guess the above is basically equivalent to

        C:> start dosbox-for-perl.pif > outfile

        The pif file then opens a window to run the script, the output is
        displayed in the window, and the window closes and the output is
        lost to view.

        You don't see the other window because the pif is configured to
        hide the window.

        The outfile only gets the output from the original "start"
        command, but there isn't any output from that.  In particular, the
        perl running in the other window does not have any redirection of
        it's output.

I'm not suggesting that a pif file is actually used.  Just that the NT
file extension mechanism used to launch perl.exe probably uses the same
low level calls that would be used if there were a pif file, and the pif
file is easy to describe.  (A pif is similar to a .lnk file).

$0.02

However, a similar sounding problem about NT command line output and
redirection has been discussed once or more times before, so perhaps those
discussions might shed light on the matter.



Tue, 10 May 2005 22:44:53 GMT  
 command-line output re-direction in winNT

(snipped)

Quote:
>   c:> perl fnc.pl arg1 arg2  > outfile
> Sends output to outfile.
>   c:> fnc.pl arg1 arg2  > outfile
> Creates outfile, but it's empty.

Create your file first, then write.

c:> fnc.pl argument_1 argument_2 >> outfile

  >>   create and write

Purl Gurl
--
 purlgurl.net is scheduled for opening January 1, 2003
 Perl Tips & Tricks, Free Scripts And Lots Of Rock N Roll



Tue, 10 May 2005 23:34:29 GMT  
 command-line output re-direction in winNT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In a fit of e{*filter*}ment on Fri, 22 Nov 2002 21:05:53 GMT,

Quote:
> perl, version 5.005_03 built for MSWin32-x86-object
> WinNT, SP6A

> NT cmd.exe window:
>   c:> perl fnc.pl arg1 arg2  > outfile

> Sends output to outfile.

>   c:> fnc.pl arg1 arg2

> prints same output on console.

>   c:> fnc.pl arg1 arg2  > outfile

> Creates outfile, but it's empty.  Any clues as to why would be
> appreciated.

George,

Maybe a weird question, but does fnc.pl actually write anything to
STDOUT? I don't know what code you have in that file, so taking a stab
in the dark so to speak.

Regards,

  Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.3

iQA/AwUBPd6z42fqtj251CDhEQJVTACfexROtRmYtStIll0JgMTguE4JeQEAoNMM
zlPLWtw1pCjkDgRHp8l77spY
=assT
-----END PGP SIGNATURE-----

--
Ian.H  (Design & Development)
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.



Tue, 10 May 2005 23:45:43 GMT  
 command-line output re-direction in winNT

Quote:

>   c:> fnc.pl arg1 arg2  > outfile

> Creates outfile, but it's empty.  Any clues as to why would be
> appreciated.

Yup, same as on mine.  I just explicity start perl when I want to
redirect, I never thought much about why.  I mean, when I think about
all the monkey-motion going around in the background, I'm amazed
anything works on a computer ;).

If it's important, you might be able to change this behaviour by playing
with the file associations for .pl.  There's a lot of control in how a
.pl file gets opened up when it's "opened."



Wed, 11 May 2005 02:24:40 GMT  
 command-line output re-direction in winNT
On 22 Nov 2002 13:44:53 -0800

 Malcolm> I will guess the above is basically equivalent to

 Malcolm>    C:> start dosbox-for-perl.pif > outfile

 Just the easiest way is to wrap your .pl into .bat|.cmd.
 Works fine and handles both stdout and stderr normally.

--
ISD Configuration Management Team



Mon, 16 May 2005 09:47:43 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. capturing command line error or output from `<command>`

2. Output of a command line command

3. Output redirection and output to a file

4. novice question: how import many lines of command output

5. Command line options Input >Output how?

6. Unicode output in Command Line

7. SNMP PERL module / command-line output differ

8. Capturing Command Line Output

9. capturing command-line output in NT - grrr!

10. outputting blank lines via the write command

11. browser output different from command line

 

 
Powered by phpBB® Forum Software