1.

Solve : Batch file help - Start /w does not continue?

Answer»

I am not a programmer, however I am a technical writer and understand "some" code.

I am using Windows 7 and have a high end machine with 64 GB memory.

I am running a simple batch file that uses START /W to start a cmd file. It is important that the file finished before it continues executing the batch file. Start /w stops the batch file from continuing but it does not recognize when the cmd is finished. Consequently, The batch file is never continued.

I have tried START /w and START /wait. Neither works.
How do I make the batch file understand when the cmd file is done.

This batch file is intended to start a series of backup programs and record the time and date that each backup was completed by creating an empty folder at the top of each directory backed up. It is important the the empty directory is not created until the backup is finished.

Below is the test code for my batch file.

ECHO ON
CD /d C:\Temp
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"
CD /d D:\
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"

REM 00-Backup-JFileSync is the directory where the backup PROGRAM is located
CD D:\00-Backup-JFileSync

Start /w 00-CTempTest
CD D:\000-BackupTest
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"

CD D:\00-Backup-JFileSync
Start /w 00-BackupTestDtoZ

CD D:\
RD "$LAST BACKUP FINISHED"
MD "$LAST BACKUP FINISHED"

Thank you in advance for your help.

JimStart command will send the instruction to start and move on. If you want to wait for the 00-CTempTest to start and complete before moving on to CD D:\000-BackupTest then simply REMOVE the start instruction and it will not continue until that program has ended with the rest of the batch instruction. Assuming its an EXE your calling this is what might WORK. OR if you do want it to start /w you will need to specify the file extension in its name which could be the problem as well. So if its an EXE add the .exe because otherwise the OS doesnt know what 00-CTempTest and 00-BackupTestDtoZ is and it will fail. Also you want these programs to be in the same folder or directory of that of the batch file to run so it will find them. Although if you dont want the programs to reside in same folder or directory of the batch, then I would suggest full pathing used such as Start /w D:\00-Backup-JFileSync\00-CTempTest.exe to explicitly target the executable vs treeing down to it within batch.

Quote

ECHO ON
CD /d C:\Temp
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"
CD /d D:\
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"

REM 00-Backup-JFileSync is the directory where the backup program is located
CD D:\00-Backup-JFileSync

Start /w 00-CTempTest.exe
CD D:\000-BackupTest
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"

CD D:\00-Backup-JFileSync
Start /w 00-BackupTestDtoZ.exe

CD D:\
RD "$LAST BACKUP FINISHED"
MD "$LAST BACKUP FINISHED"



OR



Quote
ECHO ON
CD /d C:\Temp
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"
CD /d D:\
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"

REM 00-Backup-JFileSync is the directory where the backup program is located
CD D:\00-Backup-JFileSync

00-CTempTest.exe
CD D:\000-BackupTest
RD "$LAST BACKED UP"
MD "$LAST BACKED UP"

CD D:\00-Backup-JFileSync
00-BackupTestDtoZ.exe

CD D:\
RD "$LAST BACKUP FINISHED"
MD "$LAST BACKUP FINISHED"
Answered on Dostips.
http://www.dostips.com/forum/viewtopic.php?f=3&t=6943


Discussion

No Comment Found