windows cmd 中的虚拟命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7190536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Dummy command in windows cmd
提问by artyom.stv
In linux we have a makefile:
在linux中,我们有一个makefile:
$(foreach A,a b,echo $(A) &&) true
It works and echos
它起作用并产生回声
a
b
Now we want to port it to Windows. The shortest command I've found for Windows that does nothing:
现在我们想把它移植到 Windows 上。我为 Windows 找到的最短命令什么都不做:
if 0==1 0
So the makefile example will look like
所以makefile示例看起来像
$(foreach A,a b,echo $(A) &&) if 0==1 0
Is there any dummy command in Windows in box (that really does nothing)? Or any nice hack?
Windows 中是否有任何虚拟命令(实际上什么都不做)?或者任何好的黑客?
回答by Raymond Chen
The rem
command does nothing.
该rem
命令不执行任何操作。
回答by Ricardo Stuven
The call
command without any argument does nothing and has no collateral effect as rem
has.
call
没有任何参数的命令什么也不做,也没有附带效果rem
。
Example:
例子:
echo Wait for it...
call
echo Nothing happened!
回答by zainka
Old thread, new answer.
旧线程,新答案。
I have been using cd.
when I want to do nothing in windows (and I often do) since "change directory to itself" has no side effects at all as far as I can see.
cd.
当我不想在 Windows 中做任何事情时(我经常这样做),我一直在使用,因为就我所见,“将目录更改为自身”根本没有副作用。