FG
💻 Software

how do I pipe to the "for" command?

Fresh5 days ago
Mar 15, 202633423 views
Confidence Score0%
0%

Problem

How do I pipe to the for command. So instead of I would like to be able to do it on one line.

Error Output

C:\asd>ipconfig | findstr "Address" >a

   C:\asd>for /f "tokens=15" %f in (a) do @echo %f
   192.168.1.3

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: how do I pipe to the "for" command?

Low Risk

Although it doesn't appear to be documented, you can pipe to the command inside the FOR command. I first learned about it from this example: This modified version of your code works: You can also use "more" inside the FOR command, as described in th…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment