#1 20 Jan 2020 20:12

Shane
Member
From: Victoria, BC
Registered: 17 May 2018
Posts: 11

How do I pipe error messages?

Greetings,

I would like to direct the output from one command into another. I tried this:

dir /a-d /b | findstr /c:"File Not Found"

However, error messages ("File Not Found") are not redirected into the second command (findstr).

I thought maybe this would help:

2>&1

I just don't know where I would put it.

Thanks,
Shane.


Windows 10 Home 64-bit

Offline

#2 20 Jan 2020 22:37

RG
Member
From: Minnesota
Registered: 18 Feb 2010
Posts: 356

Re: How do I pipe error messages?

dir /a-d /b 2>&1 | findstr /C:"File Not Found"

Windows Shell Scripting and InstallShield

Offline

#3 20 Jan 2020 23:06

Shane
Member
From: Victoria, BC
Registered: 17 May 2018
Posts: 11

Re: How do I pipe error messages?

Thanks. I'm trying it now.


Windows 10 Home 64-bit

Offline

Board footer

Powered by FluxBB