Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating a batch file for programs to start using a delay

Tags:

batch-file

I'm trying to write a batch file which starts some programs automatically with a delay. because it takes forever for my pc to start and i also get the unresponsiveness because of it.

this is how it looks like right now:

@echo off
TIMEOUT 5
start D:\somepath\someapp.exe
TIMEOUT 50
start "E:\somepath\someapp.exe"

because the last line is surrounded with quotation marks, the 'someapp.exe' didnt got started.

can someone explain why it didnt start the app? the first one however, did got started up.

also, how can i hide the command prompt?

thanks in advance!

like image 281
Yustme Avatar asked Nov 30 '11 10:11

Yustme


1 Answers

See help start. The first quoted argument is treated by start as the command window title. So your quoted "E:\somepath\someapp.exe" was the tile of an empty command window. Where as unquoted E:\somepath\someapp.exe was an actual command.

If you need to quote the command, use another quoted string first as the window title.

start "Someapp Window Title" "E:\somepath\someapp.exe"

Or if you don't want to provide a window title, provide the path and command separately with /D switch

start /D "E:\somepath" someapp.exe

You can use the /B switch to stop creating a new window to start the command

start /D "E:\somepath" /B someapp.exe

Or you can use the /MIN switch to start the window minimized

start /D "E:\somepath" /MIN someapp.exe
like image 76
Raihan Avatar answered Sep 22 '22 22:09

Raihan