What's the Windows command shell equivalent of Bash's `true` command?

后端 未结 4 725
庸人自扰
庸人自扰 2021-01-04 03:22

I have written a Vim plugin which shells out to run external commands. Two of the commands I run are diff and grep which can each exit with a non-z

4条回答
  •  借酒劲吻你
    2021-01-04 03:49

    The context is a Windows cmd shell (used by the git-cmd.bat script):

    Following "Exiting batch with EXIT /B X where X>=1 acts as if command completed successfully when using && or || operators between batch calls", you could define in your path a true.bat file with:

    @%COMSPEC% /C exit 1 >nul
    

提交回复
热议问题