Which command in Windows command script (.cmd) accepts pipe (so, no error "The Process tried to write to a nonexistent pipe." generated), but generates no output itself, including output to StdErr? I need to not touch normal StdErr output (keep in mind, pipe transports only StdOut). I can't use null device, due to it's not installed in the system.
For example, command|rem
generates mentioned error. But I want no error output, except generated by command
, so rem
is not suitable command for needed purpose.
Main aim is the script speed. So, don't offer extensive constructions, please.
Asked
Active
Viewed 146 times
0

green
- 335
- 2
- 10
-
2If you don't want to output anything, then why write a command in the first place? Plus: the `nul` device is always there, you can't remove it. – Oct 24 '15 at 22:33
-
1[/dev/null in Windows?](http://stackoverflow.com/q/313111) – wOxxOm Oct 24 '15 at 22:35
-
1I find it hard to believe you can't use nul. – Squashman Oct 24 '15 at 23:26
-
@a_horse_with_no_name: I'm not sure that's true. I haven't tested this, but if you remove the registry entry for the `NUL` device from the Session Manager's DOS Devices key (and then reboot) I imagine it would remove the device. It would a dumb thing to do, but I've seen dumber. – Harry Johnston Oct 25 '15 at 00:32
-
1You are right, there is no /dev/null on Windows. However, there is NUL. – lit Oct 25 '15 at 01:58
-
The Windows XP Embedded does NOT have null. – green Oct 25 '15 at 09:19
2 Answers
0
should be break
(or set/p=
?) as it is internal command prompt command (i.e. no external process started ) and generally do nothing.Though I suppose if you are searching for executable packed with the windows answer will be different.

npocmaka
- 55,367
- 18
- 148
- 187
-
`break` don't accept pipe. But `set/p=` does! Thanks for advise. Now I perform commands testing in `for` cycle. If here will be no best answer before my testing be finished, I'll post result here as my own answer. – green Oct 25 '15 at 10:24
0
The cd .
command is what you are looking for. I used it to create empty files. This way, command | cd .
works and echo Hello >&2 | cd .
show "Hello" in the screen! This works as a filter that just blocks Stdout (interesting).

Aacini
- 65,180
- 12
- 72
- 108