2016-09-08 7 views
-2

サイトを検索していくつか試しましたが、問題を解決できません。これは次のようなものです: 別のバッチファイルから2つのバッチファイルを開始します。バッチファイルが「START」されたくない

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

+0

変数**%ScriptAlarmDrive%**および**%ScriptBackupDrive%**を割り当てる場所が表示されません。 – Squashman

答えて

0

startを使用すると、2つのバッチファイルを同時に実行できます。 (バッチファイルなので)順番に実行するにはcallを使用します。とにかく最後にバッチ出口としてexit /bの必要はありません。

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. 
+0

情報をありがとう、ありがとう。 私はあなたに情報を伝えたいと思っていました。 可能であれば、私はまだAlaramを起動したいが、バックアップファイルを呼び出す – Moe

+0

同時に実行したいのですか? –

+0

はい。バックアップは、私に留意せずに実行することができますが、私はそのアラームが私に何を伝えているのか見たいと思っています。 – Moe

0

あなたは1つの.batスクリプトからこれら2つの.batのスクリプトを呼び出すことができます。

コピーし、以下のスクリプトと、その後CALL.bat

もチェックを実行しますが、これらのスクリプトは全て同じフォルダ内にあることを確認しますAlarmBatch.batBackupBatch.bat を持っている2つのスクリプトCALL.bat

CALL AlarmBatch.bat 
CALL BackupBatch.bat 

名に貼り付けthisおよびthis。それはすべてcallと関係がある。

+0

私は解決策を見つけました。問題は、バッチファイルの宛先を格納した変数を受け入れることができなかったことです... これはこのようなもので、完全に動作しています: START D:\ Skripte \ alarm.bat CALL%ScriptBackupDrive% – Moe

関連する問題