Redirect the output of netstat to a file?
50,037
I suggest trying:
runas /noprofile /user:xxxxx\administrator "netstat -a -b" > C:\temp\file.txt
or:
runas /noprofile /user:xxxxx\administrator "netstat -a -b" 2> C:\temp\file.txt
i.e., redirect the output of the runas
command (which should encompass the output of the netstat
command) rather than redirecting the output of the netstat
command directly.
Related videos on Youtube
Author by
leeand00
Projects jobdb - Creator of Open Source Job Search Document Creator/Tracker http://i9.photobucket.com/albums/a58/Maskkkk/c64nMe.jpg Received my first computer (see above) at the age of 3, wrote my first program at the age of 7. Been hooked on programming ever since.
Updated on September 18, 2022Comments
-
leeand00 over 1 year
I'm trying to redirect the output of
netstat
to a file and it doesn't work.Initially I tried:
runas /noprofile /user:xxxxx\administrator "netstat -a -b > C:\temp\file.txt"
Then I read somewhere that the output of netstat is sent to std.err:
runas /noprofile /user:xxxxx\administrator "netstat -a -b 2>C:\temp\file.txt"
I've also tried it this way:
runas /noprofile /user:xxxxx\administrator "netstat -ab 2> C:\temp\file.txt"
None of these seem to result in the file
C:\temp\file.txt
being populated with the output.-
leeand00 over 11 yearsactually using
1>
instead only worked on my machine, not on the user's machine. :-p -
Scott - Слава Україні over 11 yearsIs the
C:\temp\file.txt
created by any or all of the above commands, with nothing written to it? Does the output of thenetstat
command appear on the screen (or anywhere else)? Have you tried this with a simple command, likedir
,date /t
,hostname
, orping 127.0.0.1
?
-
-
DavidPostill almost 8 yearsPlease read the question again carefully. Your answer does not answer the original question.