windows ->nul 批量命令之前或之后的重定向

标签 windows batch-file cmd nul

在命令提示符中,以下两行给出相同的输出,我想知道它们之间的用法差异。谢谢。

>nul dir

dir >nul

最佳答案

没有区别,它们重定向相同数量的输出。您可以通过多种方式组合输入和输出重定向运算符: > out.txt command < in.txt< in.txt command > out.txt .

正如评论中所指出的,如果某些内容包含数字 1 或 2,你必须小心,你不想要 %something%>out.txt扩展到...2>out.txt您可以使用空格或将其放在命令的其余部分之前来完成此操作。

关于windows ->nul 批量命令之前或之后的重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44957124/

相关文章:

windows - cmd批处理中的自动完成路径

windows - Windows 上的 Tomcat 日志传送到 logstash

node.js - Nodemon 在 Windows Docker 环境中不重启

batch-file - 如何使用批处理运行没有扩展名的exe

windows - 运行 cmd 命令工作但从批处理文件运行不

batch-file - 将加号添加到批处理文件 url

Python timeit命令行错误: "SyntaxError: EOL while scanning string literal"

windows - python : bad handshake error on get request when executed on windows but not linux

windows - 在 PowerShell 中运行 openssl 命令

python - Unicode 无法正确打印到 cp850 (cp437),打牌套装