Page 1 of 1

can anybody demonstrate the pipe creates new instance of cmd, issue?

Posted: 21 Mar 2017 10:49
by taripo
I've often heard that pipes create a new instance of cmd..

I don't see it though

If I go to e.g. the windows directory and I do dir /p | more, then I don't see a new cmd.exe instance appear in task manager.

i'm also interested in when that has ramifications that some might not foresee.

thanks

Re: can anybody demonstrate the pipe creates new instance of cmd, issue?

Posted: 21 Mar 2017 13:45
by aGerman
The new instance is most likely alredy terminated before the Task Manager updated the list. You will need blocking commands. E.g.

Code: Select all

pause>nul|set /p "=Hello, World!"


Steffen

Re: can anybody demonstrate the pipe creates new instance of cmd, issue?

Posted: 21 Mar 2017 15:17
by taripo
it seems to create two command processes

Code: Select all

pause>nul|set /p=sdf


seems to be creating two cmd processes

So if I open a cmd.exe window, I have one showing in task manager

then I run that and I get 3 running. So it created two.

why?

I notice that pause or pause>nul, doesn't create a cmd process. So it seems like the pipe to set /p=asdf creates two.

Re: can anybody demonstrate the pipe creates new instance of cmd, issue?

Posted: 21 Mar 2017 15:33
by aGerman
That's what Process Explorer shows:
pipe.PNG
pipe.PNG (9.64 KiB) Viewed 7318 times


Steffen

Re: can anybody demonstrate the pipe creates new instance of cmd, issue?

Posted: 21 Mar 2017 16:24
by taripo
thanks

Re: can anybody demonstrate the pipe creates new instance of cmd, issue?

Posted: 21 Mar 2017 16:37
by dbenham
You should read the Q&A at http://stackoverflow.com/q/8192318/1012053.

There are lots of consequences discussed there.


Dave Benham