Exit a batch file

Associate
Joined
31 Jan 2007
Posts
1,860
Hey,
I ahve written a small .bat file whcih I am going to place into my startup folder. When I run the batch file, a command line window appears but doesn't close itself automatically. What can I add to the end of the file to make the window close?
 
"D:\Neil\Documents\Small Single Programs\FreeFileSync\64 Bit\RealtimeSync.exe" "D:\Neil\Documents\Config and Plugins\FreeFileSync\keepass_to_dropbox.ffs_batch"

exit
 
Maybe you need the start command before you call the realtimesync program.
Yep, that'll do the trick, the batch file is waiting for realtimesynce to finish before moving to the next command. Using start will return control to the batch file as soon as realtimesync starts.
 
start "D:\Neil\Documents\Small Single Programs\FreeFileSync\64 Bit\RealtimeSync.exe" "D:\Neil\Documents\Config and Plugins\FreeFileSync\keepass_to_dropbox.ffs_batch"

exit

Is that what you have now?
 
Code:
start "D:\Neil\Documents\Small Single Programs\FreeFileSync\64bit\RealtimeSync.exe" "D:\Neil\Documents\Config and Plugins\FreeFileSync\keepass_to_dropbox.ffs_batch"

not

Code:
start
"D:\Neil\Documents\Small Single Programs\FreeFileSync\64 Bit\RealtimeSync.exe" "D:\Neil\Documents\Config and Plugins\FreeFileSync\keepass_to_dropbox.ffs_batch"
 
Have you tried copying the entire line and running it manually (pasting) into a command prompt to see if it returns you to the command prompt after it's launched? if so it should work in a batch file with "exit" on the after it.
 
Right, I tried it exactly as you posted above and it then comes up with a dialog asking what program should the .ffs_batch file be opened with

That should not be showing up. If I take out the start command then it wokrs as I want except the command window does not go away.
 
According to the help syntax for the Start command, the first set of quotes is to set a title for the window. Maybe Start is taking your first set of quotes and treating that as a title rather than a command. Can you add a title to the syntax first?
Eg

Start "Title of Window" "Command to run..."?
 
create a link to the program that you want to open and just reference the link "c:\app.lnk" in the bat file

once the link has been called, it'll go to the next thing in the bat file

or just use startup as mentioned
 
Back
Top Bottom