This is our old Q&A Site. Please post any new questions and answers at

Looks simple but is annoying...

dumpcap.exe -D >> interfaces.txt


tshark.exe -D >> interfaces.txt

Because interface numbers can be different among different machines, i want to use this command to sort out the Local Ethernet Cable connection and use it as a variable in my tshark script after sorting this out first... but i can't seem to print a list to a txt file?!


asked 08 Mar '12, 05:26

Marc's gravatar image

accept rate: 27%

Thats because the output of dumpcap -D isn't printed to stdout, but to stderr, and what you're trying to do is to redirect stdout to a file. So you need to redirect stderr instead.

Try this: dumpcap -D 2>interfaces.txt, where the "2>" stands for "please redirect stderr".

See this Microsoft Ressource for a detailed explanation of the redirecting of handles.

permanent link

answered 08 Mar '12, 05:34

Jasper's gravatar image

Jasper ♦♦
accept rate: 18%

edited 08 Mar '12, 05:36

Djeez! That was very fast ;-) Thanks Jasper!

(08 Mar '12, 05:40) Marc

Could i use this in 1 commandline? ie something like.. tshark.exe -D | grep therightinterface | tshark capturecommandline

(08 Mar '12, 05:50) Marc

Depends... you'll have to redirect stderr to stdout to be able to pipe it, e.g. like this: tshark -D 2>&1|grep therightinterface...

(08 Mar '12, 06:02) Jasper ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 08 Mar '12, 05:26

question was seen: 15,727 times

last updated: 19 Nov '12, 01:47

p​o​w​e​r​e​d by O​S​Q​A