运行bat文件集的逻辑

2024-09-29 19:24:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我有python代码可以做到这一点:

  1. 写入类型A BAT文件(例如abat1、abat2…)
  2. 使用dos命令“start abat1”运行类型A BAT文件。。等等
  3. 其他代码。你知道吗
  4. 写入类型B BAT文件(如bbat1、bbat2..)
  5. 使用dos命令“start bbat1”运行类型B BAT文件

这里的问题是,我无法实现一个逻辑,我想确保bbat1应该只在abat1完成后才开始运行,因为有一些依赖关系。类似地对于其他类型A和B bat文件。你知道吗

在bat文件或python代码本身中是否可能有这样的逻辑?你知道吗

注意:我不能使用“start/wait”,因为需要并行运行所有类型A文件。我想要的“等待”是介于A型和B型文件之间的。你知道吗


Tags: 文件代码命令类型关系逻辑startwait
1条回答
网友
1楼 · 发布于 2024-09-29 19:24:46

您可以使用文件指示符:

  • 阿巴特

    type nul>running.ind
    rem here is the code of your abat
    del running.ind
    
  • bbat公司

    :loop
    if not exist running.ind goto :main
    rem wait fife seconds
    ping -n 6 localhost >nul
    goto :loop
    :main
    rem more code here
    

也可以使用注册表项来代替文件。你知道吗

相关问题 更多 >

    热门问题