windows - 如何从 .bat 循环运行 *.exe/key

标签 windows batch-file

我有目录结构:

DIR
|-UNINSTALL.BAT
|-component_name
  |-source
  |-setup.exe
  |-uninst.bat
|-another_component_name
  |-source
  |-setup.exe
  |-uninst.bat
|-yet_another_component_name
  |-source
  |-setup.exe
  |-uninst.bat

等等……

在像“component_name”这样的每个目录中,我都有 setup.exe 文件,它将当前组件安装到 Delphi 中的调色板组件。 uninst.bat 只包含这个字符串:

"setup.exe"/uninstall

所以我需要在 DIR 中编写 UNINSTALL_ALL.bat,它将在所有组件目录中运行 uninst.bat。

提前谢谢你。

最佳答案

你可以用这条线来做:

 for /f %%a in ('dir /b /s uninst.bat') do call %%a

请注意,'%%' 是批处理文件所必需的。如果你在命令行上测试它,只使用一个 '%'

关于windows - 如何从 .bat 循环运行 *.exe/key,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1024787/

相关文章:

c++ - 结合 blits 和 gdi 绘图(不工作,闪烁)

Windows 任务计划程序 : how trigger task then program has closed?

batch-file - 根据文件数量将文件从文件夹移动到新文件夹

java - 如何使 runtime.getruntime().exec(String command) 返回一个 boolean 值?

python - '\r'在Python `lineterminator`中不能作为 `csv.writer()`

使用 Linux 上不会发生的长列表时的 Python MemoryError

c++ - GLEW 链接器错误 undefined reference to '_glew*'

batch-file - 始终以/u? 启动批处理文件?

windows - 如何在 Jenkins 构建批处理命令中在 Windows Server 上使用 Angular CLI

windows - 如何在不使用 TASKILL [BATCH] 的情况下关闭从 CMD 启动的可执行文件的窗口