Board logo

标题: [其他] 新人求助 批处理怎样忽略其中的某一个exe文件? [打印本页]

作者: shiyi1988    时间: 2012-8-17 13:54     标题: 新人求助 批处理怎样忽略其中的某一个exe文件?

本帖最后由 shiyi1988 于 2012-8-17 15:14 编辑
  1. @echo off
  2. cls
  3. echo 正在安装补丁
  4. for /r %%i in (*.exe) do echo 安装%%~ni.exe && %%i /quiet /norestart
  5. echo windows重启系统使设置生效!
  6. exit
复制代码
跳过其中某一个exe文件,如目录下有a.exe、b.exe、c.exe、d.exe 只运行b.exe、c.exe、d.exe 而不运行a.exe怎么改
作者: apang    时间: 2012-8-17 15:27

  1. @echo off
  2. cls&echo 正在安装补丁
  3. for /r %%i in (*.exe) do (
  4.   if /i not "%%~ni"=="a" echo 安装%%~ni.exe && "%%i" /quiet /norestart
  5. )
  6. echo windows重启系统使设置生效!
  7. pause
复制代码

作者: shiyi1988    时间: 2012-8-17 15:48

回复 2# apang


    谢谢
作者: 狗屁不通    时间: 2012-8-17 22:29

这样也可以:
  1. dir /a-d /b|find "a.exe"&&start list.bat ||echo a.exe不存在
复制代码
list.bat
  1. start b.exe
  2. start c.exe
  3. start d.exe
复制代码





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