Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

batch file to open 2 progs with time delay

115 views
Skip to first unread message

Andy

unread,
Sep 17, 2007, 10:57:57 AM9/17/07
to
Hi,

Could anyone please tell me how i write a batch file (.bat) to open 2
programs, the first to open immediately and the second one with a 20
second delay after the first one ??

for example:

I want to open Google Earth first (on my PC it is : C:\Program
Files\Google\Google Earth Pro\googleearth.exe)

Then i want to open another program (Event Manager) 20 seconds after
Google Earth (this program is at C:\Documents and
Settings\Andrew\Desktop\DUMP\EventManager\EventManager.exe on my PC)

I have tried, but i cannot get it to work.


Best Regards,
Andrew

Mark L. Ferguson

unread,
Sep 17, 2007, 3:00:19 PM9/17/07
to
You can 'start' a script file from the bat file, and use the argument to
'wait' till it returns. This could be a script that waits 20 seconds before
returning.

---example.bat--
start first.exe
start /wait myscript.vbs
start second.exe
--end file--

--myscript.vbs
wscript.sleep 20000
--end file--
--
Mark L. Ferguson
e-mail subject line must include "QZ" or it's deleted
.
"Andy" <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote in message
news:cKvha1HhABxci...@apple100.NOSPAMfreeserve.co.uk...

Anteaus

unread,
Sep 17, 2007, 3:00:29 PM9/17/07
to
Not possible by batch commands, but a very simple script will do this:

; Delay.au3
; Compile with AutoIt 3.x, http://www.autoitscript.com
; Usage in batch: Delay {seconds}

Opt ("TrayIconHide",1)

if $cmd[0] > 0 then
$thisDelay=$cmd[1] * 1000
sleep($thisDelay)
endif
exit


Andy

unread,
Sep 17, 2007, 3:11:59 PM9/17/07
to
Sorry Mark, i don't understand any of that. Just wanted an example that
i could tailor to my own needs. Do you know (based on my needs) what the
exact text file (bat) would look like ?

Best Regards,
Andrew


Mark L. Ferguson:

Bill Blanton

unread,
Sep 17, 2007, 8:27:08 PM9/17/07
to
Based on Tom's example, you could do-

start first.exe
echo wscript.sleep 20000 > temp.vbs
start /wait temp.vbs
start second.exe
del temp.vbs

This still uses the WSH, but the bat creates the script on the fly.


"Andy" <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote in message

news:rCdteGZihghWs...@apple100.NOSPAMfreeserve.co.uk...

Andy

unread,
Sep 18, 2007, 1:28:05 AM9/18/07
to
Sorry Bill, i'm a little thick and still don't get it. Do i just paste
that into a .txt doc and save it as a .bat file then execute it ???,
where do the program links go in ??? Sorry if i appear clueless, but i
am (thats why i posted here !)

Best Regards,
Andrew

Bill Blanton:

Bill Blanton

unread,
Sep 18, 2007, 4:04:34 AM9/18/07
to
Copy/paste this into notepad (don't use Word or Wordpad)
and save it as "Andrew.bat"

start "C:\Program Files\Google\Google Earth Pro\googleearth.exe"


echo wscript.sleep 20000 > temp.vbs
start /wait temp.vbs

start "C:\Documents and Settings\Andrew\Desktop\DUMP\EventManager\EventManager.exe"
del temp.vbs


"Andy" <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote in message

news:rfHJNnIGREd1P...@apple100.NOSPAMfreeserve.co.uk...

Andy

unread,
Sep 18, 2007, 12:13:18 PM9/18/07
to
Hi Bill,

Thanks for the help.

I have tried what you suggested but nothing happens !!

I run the batch file and 2 little black DOS boxes pop up saying


"C:\Documents and Settings\Andrew\Desktop>"

That's all. Nothing is executed, the 2 DOS boxes just stay there !

Any ideas ??

Best Regards,
Andrew


Blanton:

Message has been deleted

Andy

unread,
Sep 18, 2007, 1:50:56 PM9/18/07
to
Ahaaaaa ! - MARVELLOUS Bill !! - that worked ! - Thanks for all your
time and help on this one.

Much Appreciated !

Andy


Bill Blanton:
> You're right! Sorry, I didn't test it. Forget the bat file, and use
> a visual basic script instead. Copy/paste this in notepad and save
> it as "Andrew.vbs"
>
>
> dim oShell
> Set oShell=WScript.CreateObject("WScript.Shell")
>
> oShell.Run "calc.exe",1,false
> wscript.sleep 20000
> oShell.Run "notepad.exe",1,false
>
>
>
> If it works, replace "calc.exe" and "notepad.exe" with your complete
> programs' paths and names.


>
>
>
>
> "Andy" <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote in message

> news:RyulfcsyDK6qn...@apple100.NOSPAMfreeserve.co.uk...

Andy

unread,
Sep 18, 2007, 1:59:47 PM9/18/07
to
Ah, Bill, sorry - it DID work with your calc.exe and notepad examples.
But it doesn't work in the realworld with the links to my programs !!

Not sure why, because your theory is correct (as it does indeed work
with your examples).

Think i'll give up !!!

Andy

unread,
Sep 18, 2007, 2:01:26 PM9/18/07
to
Further to my last.

I get error message:

Script : C:\Documents and Settings\Andrew\Desktop\Andrew.vbs
Line : 4
Char : 1
Error : The system cannot find the specified file
Code: 80070002
Source : (null)

Cheers,

Bill Blanton

unread,
Sep 18, 2007, 3:08:31 PM9/18/07
to
Something is mistyped with the path to the executable file. Also make
sure it is wrapped in double quotes.
(e.g.)

"C:\Program Files\Google\Google Earth Pro\googleearth.exe"

Also no line breaks in the line added by the editor.

"Andy" <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote in message

news:G2adMwdhWxyDh...@apple100.NOSPAMfreeserve.co.uk...

Andy

unread,
Sep 18, 2007, 4:19:31 PM9/18/07
to
Regards Bill, i'll have a closer look at it, but it does seem to be the
correct path, no broken lines etc. I'm a bit stumped by this !

Cheers,
Andrew


Bill Blanton:

Bill Blanton

unread,
Sep 18, 2007, 8:54:57 PM9/18/07
to
Its got to be that. As a test, copy/paste the program path into the Start > Run...
dialog box. If it doesn't run it's incorrect.

"Andy" <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote in message

news:CCtyeSIf0BXGr...@apple100.NOSPAMfreeserve.co.uk...

Andy

unread,
Sep 19, 2007, 12:16:50 PM9/19/07
to
Hi Bill,

I have tried that and it does run in the Start - Run command !! - just
not in the vbs file !! - that's the weird bit !!!!

Cheers,
Andrew

Bill Blanton:

Message has been deleted

Andy

unread,
Sep 19, 2007, 3:14:55 PM9/19/07
to
Cheers Bill. Will do, what's the e-mail add to send it to ?

Best Regards
Andy

Bill Blanton:
> How about sending me the file as an attachment, so I can look at it.
> Rename it Andrew.txt so it doesn't get flagged and deleted along the
> way.


>
>
>
> "Andy" <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote in message

> news:dtev6UW3Gjzhr...@apple100.NOSPAMfreeserve.co.uk...

Zilbandy

unread,
Sep 19, 2007, 3:25:06 PM9/19/07
to
On wed, 19 sep 2007 20:14:55 +0100, "Andy"
<andyN...@apple100.NOSPAMfreeserve.co.uk> wrote:

>Cheers Bill. Will do, what's the e-mail add to send it to ?

I hope any solutions found are posted to this thread. I'd also like to
start a couple of apps using the vbs script and haven't got it to work
here either, although the calc and notepad example works fine.

--
Zilbandy <zilb...@comcastREMOVETHIS.net> Tucson, Arizona USA
Dead Suburban's Home Page: http://zilbandy.home.comcast.net
PGP Public Key: http://zilbandy.home.comcast.net/pgpkey.htm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Andy

unread,
Sep 19, 2007, 3:57:49 PM9/19/07
to
Thanks, yeah i'll post back here if i can get this solved !

Best Regards,
Andrew


Zilbandy:

Bill Blanton

unread,
Sep 19, 2007, 5:45:05 PM9/19/07
to
"Zilbandy" <zilb...@comcastREMOVETHIS.net> wrote in message news:oot2f3d8ggv31o5v3...@4ax.com...

> On wed, 19 sep 2007 20:14:55 +0100, "Andy"
> <andyN...@apple100.NOSPAMfreeserve.co.uk> wrote:
>
>>Cheers Bill. Will do, what's the e-mail add to send it to ?
>
> I hope any solutions found are posted to this thread. I'd also like to
> start a couple of apps using the vbs script and haven't got it to work
> here either, although the calc and notepad example works fine.

Will do. If I figure out what's going on.

I have no problem using the full paths to notepad and calc.

Zilbandy

unread,
Sep 19, 2007, 5:55:19 PM9/19/07
to
On Wed, 19 Sep 2007 17:45:05 -0400, "Bill Blanton"
<bbla...@REMOVEmagicnet.net> wrote:

>Will do. If I figure out what's going on.
>
>I have no problem using the full paths to notepad and calc.

Try using a path to some other programs. I've tried using the path to
UltraEdit text editor on my system, and it doesn't work. I get exactly
the same error as Andy is getting. In my case, the path to my program
is "c:\program files\ultraedit\uedit32.exe".

--
Zilbandy

Bill Blanton

unread,
Sep 20, 2007, 7:10:57 PM9/20/07
to
"Zilbandy" <zilb...@comcastREMOVETHIS.net> wrote in message news:l963f313rhsk8tb45...@4ax.com...


Yep. Spaces in filenames strikes again..

You can either change the path to the short name equivilent, or try
this, where the script will generate the shortpath.


dim oShell, oFSO, oFile

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell=WScript.CreateObject("WScript.Shell")

Set oFile = oFSO.GetFile("C:\Windows\system32\calc.exe")
oShell.Run oFile.ShortPath,1,false

wscript.sleep 20000

Set oFile = oFSO.GetFile("c:\program files\ultraedit\uedit32.exe")
oShell.Run oFile.ShortPath,1,false


Zilbandy

unread,
Sep 21, 2007, 1:37:22 AM9/21/07
to
On Thu, 20 Sep 2007 19:10:57 -0400, "Bill Blanton"
<bbla...@REMOVEmagicnet.net> wrote:

>> Try using a path to some other programs. I've tried using the path to
>> UltraEdit text editor on my system, and it doesn't work. I get exactly
>> the same error as Andy is getting. In my case, the path to my program
>> is "c:\program files\ultraedit\uedit32.exe".
>
>
>Yep. Spaces in filenames strikes again..
>
>You can either change the path to the short name equivilent, or try
>this, where the script will generate the shortpath.

That fixed it here. Thanks for all the help. Andy and I thank you. :)

--
Zilbandy

Bill Blanton

unread,
Sep 22, 2007, 2:06:02 PM9/22/07
to
"Zilbandy" <zilb...@comcastREMOVETHIS.net> wrote in message news:01m6f3ppuo7o5ahkf...@4ax.com...

YW. And thanks for the feedback. I learned something too.

Danbo342

unread,
Dec 17, 2009, 12:07:06 AM12/17/09
to

Hey Andrew, this is my first night of writing batch files and was
actually trying to figure out the google earth issue when I found this
post. In the mean time I ended up figuring out a workaround on my own.
I'm not sure about the event manager since I have vista 64 but I tested
this out using event viewer.
My only experience is about 23 minutes and this will work 100% so not
sure but these guys look like they may be joking with you.

Anyway, this is a "Bat" file and works fine. The only problem I had was
even using many different methods, could not get google earth to run
with with the space in the string, even when I tried to use
start "C:\Google\Google Earth\client\" googleearth.exe or start
"C:\Google\Google Earth\client\googleearth.exe"

This is what I did on my system, apparently google can be cut from it's
location to anywhere you want, there is nothing tied to it, you can
rename the folders or take out the space with no problems. I cut it from
my program (x86) folder and placed it on C:\

This is what worked for me (not using pro but it shouldn't matter).

start C:\Google\GoogleEarth\client\googleearth.exe


echo wscript.sleep 20000 > temp.vbs
start /wait temp.vbs

start C:\Windows\System32\eventvwr.exe

This is a simple workaround that will work fine.
Shorten (take out the spaces) of google as I did and since event manger
won't like being relocated or renamed, simply create a shortcut for it
on your C:\ and name it "a" (extension of a shortcut is .lnk). So if
you follow this example it will look like this:


Code:
--------------------

start C:\Google\GoogleEarth\client\googleearth.exe
ping -n 20 127.0.0.1
C:\a.lnk

--------------------


You could also use the shortcut method on your googleearth.exe rather
than as mentioned above if you wanted, making it even shorter.


Code:
--------------------

start C:\googleearth.lnk
ping -n 20 127.0.0.1
C:\a.lnk

--------------------


I also just tested what someone else wrote for a time delay and it
worked. Using the VB method it would be.

Code:
--------------------

start C:\Google\GoogleEarth\client\googleearth.exe


echo wscript.sleep 20000 > temp.vbs
start /wait temp.vbs

C:\a.lnk

--------------------


Either of the ways work, but I prefer the simpler method. It's less
code and the dos box closes on it's own and no temp.vbs to clean up.
Enjoy!


--
Danbo342
------------------------------------------------------------------------
Danbo342's Profile: http://forums.techarena.in/members/164663.htm
View this thread: http://forums.techarena.in/windows-xp-support/819467.htm

http://forums.techarena.in

Danbo342

unread,
Dec 17, 2009, 10:26:45 AM12/17/09
to

Strange, but when I posted this info I copied it from my notepad after
testing. It looks like someone removed the "start" before each of the
C:\a.lnk

Make sure that line reads
start C:\a.lnk

It will still work, but the dos box will not close.

VanguardLH

unread,
Dec 17, 2009, 4:31:13 PM12/17/09
to
Danbo342 wrote:

> Hey Andrew, ...

You thought Andrew was still monitoring this /*over 2-year old*/ thread?

> http://forums.techarena.in

A leech site pretending to have forums by running a webnews-for-dummies
interface that submits improperly formatted posts through a gateway to
Usenet (aka newsgroups).

Danbo342

unread,
Dec 17, 2009, 5:49:43 PM12/17/09
to

I see the age of it, but being that I found this topic on a similiar
search, decided to take the time to post my findings should someone else
need assistance.
So in other words, just to help someone, unlike your comment just to
annoy.

David H. Lipman

unread,
Dec 17, 2009, 7:08:39 PM12/17/09
to
From: "Danbo342" <Danbo34...@DoNotSpam.com>

| VanguardLH;4731456 Wrote: > Danbo342 wrote:

>> > Hey Andrew, ...

>> You thought Andrew was still monitoring this /*over 2-year old*/ > thread?

>> > http://forums.techarena.in

>> A leech site pretending to have forums by running a > webnews-for-dummies
>> interface that submits improperly formatted posts through a gateway to
>> Usenet (aka newsgroups).

| I see the age of it, but being that I found this topic on a similiar search, decided to
| take the time to post my findings should someone else need assistance.
| So in other words, just to help someone, unlike your comment just to annoy. --
| Danbo342

techarena.in Posts annoy in general. I wish they would f'n get rid of their PITA Usenet
gateway forever. Wer are so tired of seeing replies to Usenet posts eminating from
techarena.in that never quote what they are replying to and ressurecting threads so old
the original posters (OP) no longer care.


The way to access this group is DIRECTLY with any news client via the following news
URL...

news://msnews.microsoft.com/microsoft.public.windowsxp.help_and_support

--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp


Danbo342

unread,
Dec 17, 2009, 11:05:28 PM12/17/09
to

Who keeps modifying my posts? I take the time to post helpful
information, 1st someone modifies my last line in the code, taking out
"Start" from the "C:\a.lnk" line, and now after some idiot posts a
comment to my good deed, that message is removed and my reply is now
added to my original post making it look like I am talking to Andrew...
Is this the proper use of moderating?
I believe it's actually quite illegal to change what people say, is it
not? So much for trying to help a future someone. I'm going to have
these screenshots investigated, this is bs.

Bill in Co.

unread,
Dec 17, 2009, 11:39:08 PM12/17/09
to
Nobody is modifying your (or anyone's) post. I'd suggest you stop
listening to Glenn Beck.

David H. Lipman

unread,
Dec 18, 2009, 6:20:47 AM12/18/09
to
From: "Danbo342" <Danbo34...@DoNotSpam.com>

| Who keeps modifying my posts? I take the time to post helpful information, 1st someone
| modifies my last line in the code, taking out "Start" from the "C:\a.lnk" line, and now
| after some idiot posts a comment to my good deed, that message is removed and my reply
| is now added to my original post making it look like I am talking to Andrew... Is this
| the proper use of moderating?
| I believe it's actually quite illegal to change what people say, is it not? So much for
| trying to help a future someone. I'm going to have these screenshots investigated, this
| is bs. -- Danbo342


techarena.in is a POS.

John John - MVP

unread,
Dec 18, 2009, 9:45:18 AM12/18/09
to
I hear he and Sarah Palin are an item. Hey, if they can spread lies and
innuendo so can we! If we are lucky they will move to the polar ice cap
and never be heard from again...

Danbo342

unread,
Dec 18, 2009, 10:27:38 AM12/18/09
to

Wrong!
Someone deleted a post here and took a reply I had made in a seperate
comment block and put it into my original post. See end of first comment
end

"I see the age of it, but being that I found this topic on a similiar
search, decided to take the time to post my findings should someone else

need assistance.
So in other words, just to help someone, unlike your comment just to
annoy."

That was in a different block.
As far as Glenn Beck, I never heard of him, you people here are
incredibly rude.

David H. Lipman

unread,
Dec 18, 2009, 2:46:30 PM12/18/09
to

From: "Danbo342" <Danbo34...@DoNotSpam.com>

| Wrong!
| Someone deleted a post here and took a reply I had made in a seperate comment block and
| put it into my original post. See end of first comment end
| "I see the age of it, but being that I found this topic on a similiar search, decided
| to take the time to post my findings should someone else need assistance.
| So in other words, just to help someone, unlike your comment just to annoy."

| That was in a different block.
| As far as Glenn Beck, I never heard of him, you people here are incredibly rude. --
| Danbo342


Stop using the piece od sh!t techarena.in forum and do what I told you.

DIRECTLY connect to this news group with any news client via the following news URL...

news://msnews.microsoft.com/microsoft.public.windowsxp.help_and_support

Or is it too much above your intelligence level to it ?

John John - MVP

unread,
Dec 18, 2009, 2:55:21 PM12/18/09
to
If only we could convince you to take two minutes to configure a news
reader you might see what is really going on with your Techarena posts!
The name of the Microsoft news server is: msnews.microsoft.com

Try these:

news://msnews.microsoft.com
news://msnews.microsoft.com/microsoft.public.windowsxp.help_and_support


Learn how to configure two popular newsreaders:

http://www.frickelsoft.net/news.html
How to configure Microsoft Newsgroups with Outlook Express

http://ilias.ca/moznewsgroups-tb
Subscribing to news.mozilla.org newsgroups with Thunderbird

John

VanguardLH

unread,
Dec 18, 2009, 11:06:52 PM12/18/09
to
Danbo342 wrote:

> Who keeps modifying my posts? I take the time to post helpful
> information, 1st someone modifies my last line in the code, taking out
> "Start" from the "C:\a.lnk" line, and now after some idiot posts a
> comment to my good deed, that message is removed and my reply is now
> added to my original post making it look like I am talking to Andrew...
> Is this the proper use of moderating?
> I believe it's actually quite illegal to change what people say, is it
> not? So much for trying to help a future someone. I'm going to have
> these screenshots investigated, this is bs.

And you thought any the participants were still monitoring that /*OVER
2-YEAR OLD*/ thread?

http://forums.techarena.in
A leech site pretending to have forums by running a webnews-for-dummies
interface that submits improperly formatted posts through a gateway to
Usenet (aka newsgroups).

No one here in Usenet has any control over what the moderators or admins do
regarding posts in that forum. Contact them. Better ask them quick as they
may not keep a history of deleting/modified posts so whoever had permission
to do the change would have to recall it from their memory.

You say that you weren't replying to Andrew, and that your post got deleted,
but then your post that does exist start with "Hey Andrew". Uh huh.
Perhaps what you clicked on wasn't Reply or Quote but instead Edit.

0 new messages