Batch file 批处理文件不希望为';启动';预计起飞时间
我搜索了整个网站,尝试了一些东西,但我不能解决这个问题。是这样的: 我想从另一个批处理文件启动两个批处理文件Batch file 批处理文件不希望为';启动';预计起飞时间,batch-file,batch-processing,Batch File,Batch Processing,我搜索了整个网站,尝试了一些东西,但我不能解决这个问题。是这样的: 我想从另一个批处理文件启动两个批处理文件 START %ScriptAlarmDrive% //Also tried CALL %ScriptAlarmDrive% (with EXIT /B in Alarm then) CALL %ScriptBackupDrive% 当我单独启动报警批处理或备份批处理时,它们工作正常 IF %Month% == 7 goto EchoExams IF %Month% == 9 goto
START %ScriptAlarmDrive%
//Also tried CALL %ScriptAlarmDrive% (with EXIT /B in Alarm then)
CALL %ScriptBackupDrive%
当我单独启动报警批处理或备份批处理时,它们工作正常
IF %Month% == 7 goto EchoExams
IF %Month% == 9 goto EchoNewSemester
EXIT
:EchoExams
ECHO -----Klausurentermine:
TYPE %SOURCEEXAMS% |more
ECHO. & ECHO. & PAUSE & EXIT
:EchoNewSemester
ECHO -----Im neuen Semester zu beachten:
TYPE %SourceNewSemesterTakeNote% |more
ECHO. & ECHO.
ECHO -----Informationen zum neuen Semester:
TYPE %SourceNewSemesterInformation% |more
ECHO. & ECHO. & PAUSE & EXIT
以及备份批处理文件:
ECHO -----Backup
XCOPY %SOURCE% %DEST% %PARA%
ECHO. enter code here
但是,如果启动第一批文件,则只执行备份,而不会从报警中获得输出
如果有人能帮助我,我将不胜感激。
Moe您可以使用
start
同时运行两个批处理文件。您可以使用call
按顺序运行它们(因为它们是批处理文件)。无需退出/bexit
,因为批无论如何都会在最后退出
Starting a Program
===============
See start /? and call /? for help on all three ways.
Specify a program name
--------------------------------
c:\windows\notepad.exe
In a batch file the batch will wait for the program to exit. When
typed the command prompt does not wait for graphical
programs to exit.
If the program is a batch file control is transferred and the rest of the calling batch file is not executed.
Use Start command
--------------------------
start "" c:\windows\notepad.exe
Start starts a program and does not wait. Console programs start in a new window. Using the /b switch forces console programs into the same window, which negates the main purpose of Start.
Start uses the Windows graphical shell - same as typing in WinKey + R (Run dialog). Try
start shell:cache
Use Call command
-------------------------
Call is used to start batch files and wait for them to exit and continue the current batch file.
您可以从一个
.bat
脚本调用这两个.bat
脚本
复制下面的脚本并将其粘贴到CALL.bat
CALL AlarmBatch.bat
CALL BackupBatch.bat
命名您拥有的两个脚本AlarmBatch.bat
和BackupBatch.bat
确保这些脚本都在同一文件夹中,然后运行CALL.bat
CALL AlarmBatch.bat
CALL BackupBatch.bat
还要检查和确认。这一切都与
通话有关
好的,谢谢你提供的信息。只是我想和你分享信息,我尝试了一些同样没有帮助的东西。如果可能的话,我仍然想启动Alaram,但是调用备份文件,你想让它们同时运行吗?是的。备份可以在我不记下的情况下运行,但我想看看警报告诉我什么。如果%ScriptAlarmDrive%
包含引号,它将无法工作。显示完整的代码。谢谢。它现在工作得很好。这正是我的问题。我看不出您在哪里分配变量%ScriptAlarmDrive%和%ScriptBackupDrive%。我找到了解决方案。问题是它没有接受我存储批处理文件目标的变量。。。现在它是这样的并且工作得很好:启动D:\Skripte\alarm.bat调用%ScriptBackupDrive%