@echo off
start /WAIT C:\RunCommandShortcuts\stap.lnk
shutdown –s
Will the this batch file run the indicated program (SyncToy), WAIT for it to finish, then shut down the computer? The reason I haven’t just created the batch file and run it to test it is SyncToy takes a little time to run and I’m not sure that if it is interrupted by a shutdown, the files being backed up could get corrupted.
I’m using a shortcut to start SyncToy because it was the only way I could get it to run with the right arguments. If I paste the following from the Target box of the Shortcut behind “start /WAIT” the program won’t start.
"C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -r
Will this batch file work?
Moderator: Site Mods
- FrizzleFry
- Platinum Member
- Posts: 1241
- Joined: 2005 Oct 16, 19:09
When you put quotes around the command start thinks that is the window title... so try
@echo off
start "SyncToy" /WAIT "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -r
pause
echo shutdown –s
You could add a pause or echo the shutdown command to check if the SyncToy command does finish... I have noticed that start /wait will not work if the command you run spawns other processes and ends.
@echo off
start "SyncToy" /WAIT "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -r
pause
echo shutdown –s
You could add a pause or echo the shutdown command to check if the SyncToy command does finish... I have noticed that start /wait will not work if the command you run spawns other processes and ends.
- pschroeter
- Silver Member
- Posts: 283
- Joined: 2007 Jan 27, 00:46
I figured out this code which works
I just want to mention that after asking someone I figured out this code which works:
Start "" /Wait "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -r
shutdown -s
I cannot figure out any rhyme or reason as to where the quote symbols go. I see quotes around /Wait and have no idea whats going on, I only know it works.
Start "" /Wait "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -r
shutdown -s
I cannot figure out any rhyme or reason as to where the quote symbols go. I see quotes around /Wait and have no idea whats going on, I only know it works.