vik santata
vik santata

Reputation: 3109

Cmd: how to let bat file redirect output to something like /dev/null?

Under unix, I could simple ABC >/dev/null to avoid any output to screen. But under windows' cmd, using ABC > NULL will create a file named "NULL". But how to archive the /dev/null like unix?

Thanks a lot.

Upvotes: 2

Views: 945

Answers (2)

user4958316
user4958316

Reputation:

Every folder has a nul device. It is one of the reserved names. These can be used in commands to refer to devices. Eg:

copy filename con 

copies a file to the console window.

Here are the reserved names defined by CMD:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, 
COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, 
LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9
CONIN$, CONOUT$, CONERR$

Upvotes: 3

Robin
Robin

Reputation: 1190

You are pretty close. Try NUL instead of NULL.

ABC > NUL

Upvotes: 5

Related Questions