【发布时间】:2013-11-16 09:48:17
【问题描述】:
我有 3 个调用批处理文件,例如 called1.bat :
调用1.bat
taskkill /f /im firefox.exe
net stop W3SVC
sc config W3SVC start= demand
net start W3SVC
和一个调用 Master.bat 文件,它调用所有三个调用的批处理文件,如下所示:
Master.bat
@echo off
setlocal enabledelayedexpansion
REM 1st for loop:
for /F "delims= " %i in (C:\test\Serverlist1.txt) do ( psexec \\%i start C:\data\called1.bat )
REM 2nd for loop:
for /F "delims= " %i in (C:\test\Serverlist2.txt) do ( psexec \\%i start C:\data\called2.bat )
REM 3rd for loop:
for /F "delims= " %i in (C:\test\Serverlist3.txt) do ( psexec \\%i start C:\data\called3.bat )
其实我想将 Master.bat 文件中的不同信号发送到三个被调用的 .bat 文件中,以便在一些远程服务器上运行它们,如下所示:
called1.bat file to wait until the "SIGNAL1" is received from Master.bat
called2.bat file to wait until the "SIGNAL2" is received from Master.bat
called3.bat file to wait until the "SIGNAL3" is received from Master.bat
我应该将waitfor SIGNAL1 命令放在 called1.bat 文件的什么位置?
我应该将waitfor /SI SIGNAL1 命令放在Master.bat 文件中的什么位置,以将信号发送到 called1.bat 以开始运行?其他文件也是如此..
我的主要目的是:在 Master.bat 文件中,2nd for loop 应该只在 1st for loop 完成其完整执行后才开始运行,同样3rd for loop 在 2nd for loop 之后才开始运行@这就是为什么更喜欢 @ 987654332@方法到目前为止。
【问题讨论】:
-
@Endoro...请问你能帮我吗?
-
@foxidrive..我也想请你帮忙。
-
批量使用for循环变量,百分比为
%%i。什么是信号,批次如何接收? -
我尝试使用this link..
-
我的 @Endoro..This question 将帮助您了解我的确切要求。
标签: batch-file wait remote-access psexec