Windows 上有/dev/null 吗? [英] Is there a /dev/null on Windows?

查看:24
本文介绍了Windows 上有/dev/null 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 上 /dev/null 的等价物是什么?

What is the equivalent of /dev/null on Windows?

推荐答案

我认为您需要 NUL,至少在命令提示符或批处理文件中.

I think you want NUL, at least within a command prompt or batch files.

例如:

type c:\autoexec.bat > NUL

不创建文件.

(我相信如果您尝试以编程方式创建文件也是如此,但我还没有尝试过.)

(I believe the same is true if you try to create a file programmatically, but I haven't tried it.)

在 PowerShell 中,您需要 $null:

In PowerShell, you want $null:

echo 1 > $null

这篇关于Windows 上有/dev/null 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆