Board logo

标题: [文本处理] BAT批处理命令if else为何出错? [打印本页]

作者: a136324474    时间: 2014-4-24 09:38     标题: BAT批处理命令if else为何出错?

  1. @echo off
  2. if exist a.txt del a.txt else copy nul a.txt
  3. pause
复制代码
这个命令为什么不创建后面的else 的内容呢。 前面的del是能执行的
作者: Batcher    时间: 2014-4-24 09:51

  1. @echo off
  2. if exist a.txt (
  3.     del a.txt
  4. ) else (
  5.     copy nul a.txt
  6. )
  7. pause
复制代码

作者: a136324474    时间: 2014-4-24 14:40

回复 2# Batcher


    太感谢管理员了。非常感谢。
作者: 522235677    时间: 2014-4-24 16:28

  1. if exist a.txt (del a.txt) else (copy nul a.txt)
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2