ping 192.168.0.1 > c:\ping.txt
it outputs
ping 192.168.0.1 1> c:\ping.txt
at the command prompt. When the same command is run directly from the
command prompt it runs correctly. Another PC behaves as it should when
running the same batch file.
I understand that the "1" has something to do with debugging, but what
causes it to be inserted automatically when run from a batch file, and
how do I make it stop?
--
Ray Greene
--- news://freenews.netfront.net/ - complaints: ne...@netfront.net ---
Use "@echo off" if you want to avoid an output of the service
information in the console
@echo off
ping 127.0.0.1 >ping.txt
Or shield command with "@"
@ping 127.0.0.1 >ping.txt
0 - standart input stream (STDIN)
1 - standart output stream (STDOUT)
2 - standart error stream (STDERR)
because of this behaviour, always add a space after a numeral when
redirecting to a file.
EG:
ping 192.168.0.1 > c:\ping.txt
--
Regards,
Mic
Full redirection syntax is now n>whatever where n is a digit.
The simple ">" form is implicitly "1>" to redirect stdout and this is shown
as the reported command.
Stop it? Not possible.
Side-effect: a separator when a digit appears before a redirector is now
required whereas previously it was optional.
OK thanks. Any idea why the "1" appears on one PC but not another? The
one in question is XP SP3, the one where it doesn't happen has SP2. Is
it an SP3 thing?
None whatever.
AFAIAA, this has been the case on XP before even SP1 - perhaps even in
earlier NT versions.
> OK thanks. Any idea why the "1" appears on one PC but not another? The
> one in question is XP SP3, the one where it doesn't happen has SP2. Is
> it an SP3 thing?
CMD.EXE in XP is known to behave in ways that seem random: sometimes it
does one thing, sometimes it does another. The behavior seems to be
related to the amount of time Windows has been up and/or what other
programs have run. I had one case where the probability that a given
script would fail when called repeatedly depended on the length of the
base name of the script file as well as whether the machine had been
recently rebooted - the behavior also varied across different XP machines
(I wound up running the program on a Linux box [as a cron task] and
accessing the results through a web server).
--
Ted Davis (tda...@mst.edu)
Random behaviour - gotta love it...