我在这个领域还很新,所以如果使用了错误的措辞,我会提前道歉。我正在寻找一种方法让我的批处理文件循环并重复相同的过程一次完成只使用数字列表中%3的不同数字。 %3的数字列表小于100,所以我不介意在批处理文件中写出它只是等待命令完成并写下一个数字变得乏味。这些数字也不是顺序的(即1-100)而是分散的(即2,6,21,48)。非常感谢任何和所有的帮助。在此先感谢您的时间。
@ECHO OFF
ECHO ==============STORE #%3================ >>EM_Push.log
ECHO %date% >>EM_Push.log
ECHO %time% >>EM_Push.log
IF EXIST d:\micros\res\em\transport\send\0%3\*.mpz goto start
IF NOT EXIST d:\micros\res\en\transport\send\0%3\*.mpz goto nofile
:START
ECHO ---------Mapping Drive------------ >>EM_Push.log
net use s: /d
net use s: \\10.16.%3.101\d$ /user:%1 %2 >>EM_Push.log
IF NOT EXIST s:\micros ECHO POSSIBLE NETWORK ISSUE >>EM_Push.log
IF NOT EXIST s:\micros goto end
ECHO ----------Copy Package from EM to Store %3----------- >>EM_Push.log
copy d:\micros\res\em\transport\send\0%3\*.mpz s:\micros\res\em\transport\receive >>EM_Push.log
IF NOT EXIST d:\micros\res\em\transport\send\0%3\archive md d:\micros\res\em\transport\send\0%3\archive
move d:\micros\res\em\transport\send\0%3\*.mpz d:\micros\res\em\transport\send\0%3\archive >>EM_Push.log
ECHO --------Deploy Package-------------- >>EM_Push.log
psexec \\10.16.%3.101 -u %1 -p %2 d:\micros\res\em\bin\receive.exe >>EM_Push.log
psexec \\10.16.%3.101 -u %1 -p %2 d:\micros\res\em\bin\deployment.exe >>EM_Push.log
REM ECHO ---------Exit41 Update------------- >>EM_Push.log
REM IF EXIST s:\exit41\commands\pagepull.exe psexec \\10.16.%3.101 -u %1 -p %2 d:\exit41\commands\pagepull.exe >>EM_Push.log
REM IF EXIST s:\exit41\commands\pagepull.exe ECHO Done! >>EM_Push.log
REM IF NOT EXIST s:\exit41\commands\pagepull.exe ECHO Not subscribed to Exit41 >>EM_Push.log
ECHO ----------Copy Confirmation from Stor %3 to EM----------- >>EM_Push.log
IF NOT EXIST s:\micros\res\em\transport\send\*.mpz ECHO RECEIVE PACKET NOT AVAILABLE >>EM_Push.log
IF NOT EXIST s:\micros\res\em\transport\send\*.mpz goto end
copy s:\micros\res\em\transport\send\*.mpz d:\micros\res\em\transport\receive >>EM_Push.log
IF NOT EXIST s:\micros\res\em\transport\send\archive md s:\micros\res\em\transport\send\archive
move s:\micros\res\em\transport\send\*.mpz s:\micros\res\em\transport\send\archive >>EM_Push.log
goto end
:NOFILE
ECHO NO UPDATES FOR THIS STORE >>EM_Push.log
:END
net use s: /d >>EM_Push.log
ECHO==============END STORE #%3============= >>EM_Push.log
答案 0 :(得分:0)
只需多次使用您的号码调用您的脚本。
假设您的号码在numbers.txt
:
for /f %%i in (numbers.txt) do (
call :process %1 %2 %%i
)
goto :eof
:process
REM here goes your script
您的numbers.txt
应如下所示:
2
6
21
48
...