Windows Registry

P

Pegasus \(MVP\)

Bob I said:
Start them from a bat/cmd file with a shortcut in the Startup folder

Further to Bob's reply: It may be necessary to introduce a certain delay so
that Application 1 is fully active before Application 2 starts. Based on
Bob's suggestion, this batch file will do this too:

@echo off
set delay=60
"c:\Some Folder\Application1.exe"
ping localhost %delay% > nul
"c:\Some Other Folder\Application2.exe"

Some applications won't return control to the launching batch file. If so
then you need to use this approach:
@echo off
set delay=60
start /b "Application 1" "c:\Some Folder\Application1.exe"
ping localhost %delay% > nul
start /b "Application 2" "c:\Some Other Folder\Application2.exe"
 
3

3c273

Put a batch file in your startup folder that starts them in order. You can
delay the second program by inserting a couple of pings in between.

----begin bat file-----
c:\path_to_program_1.exe
ping -n 10 localhost
c:\path_to_program_2.exe
----- end bat file-----

Someone else may come up with something fancier, but this will work.
Louis
 
S

Sid Elbow

Pegasus said:
@echo off
set delay=60
"c:\Some Folder\Application1.exe"
ping localhost %delay% > nul
"c:\Some Other Folder\Application2.exe"

Some applications won't return control to the launching batch file. If so
then you need to use this approach:
@echo off
set delay=60
start /b "Application 1" "c:\Some Folder\Application1.exe"
ping localhost %delay% > nul
start /b "Application 2" "c:\Some Other Folder\Application2.exe"

I'm interested in this approach Pegasus in another context.

I'd always assumed:

- that most (if not all) .exe programs actually *wouldn't" return to the
launching batch file if executed directly.

- that the way around that was to CALL the application rather than
simply execute it.

What's the difference between using START and CALL to launch an application?
 
P

Pegasus \(MVP\)

Sid Elbow said:
I'm interested in this approach Pegasus in another context.

I'd always assumed:

- that most (if not all) .exe programs actually *wouldn't" return to the
launching batch file if executed directly.

- that the way around that was to CALL the application rather than simply
execute it.

What's the difference between using START and CALL to launch an
application?

Whether an exe program returns control to the launching batch file depends
on how it is written. Here are two examples:
- notepad.exe (will not return control)
- explorer.exe (will return control)

The "call" command in a batch file is used to invoke another batch file,
i.e. to call a subroutine. Here is how it works:
Example 1 ("call" used)
@echo off
call c:\SomeBatchFile.bat
{Execution will resume here}

Example 2 (no "call" used)
@echo off
c:\SomeBatchFile.bat
{Code from here onwards will never execute}

In other words, "call" is used to invoke a subroutine. When the subroutine
ends then the main routine continues. If "call" is omitted then control
passes permanently from the first batch file to the second batch file, as
shown in Example 2.

There is no difference in execution in the following lines:
@echo off
notepad.exe
call notepad.exe

In other words, "call" has no effect when used with .exe files.
 
S

Sid Elbow

Pegasus (MVP) wrote:

The "call" command in a batch file is used to invoke another batch file,
i.e. to call a subroutine. Here is how it works:
Example 1 ("call" used)
@echo off
call c:\SomeBatchFile.bat
{Execution will resume here}

Example 2 (no "call" used)
@echo off
c:\SomeBatchFile.bat
{Code from here onwards will never execute}

In other words, "call" is used to invoke a subroutine. When the subroutine
ends then the main routine continues. If "call" is omitted then control
passes permanently from the first batch file to the second batch file, as
shown in Example 2.

There is no difference in execution in the following lines:
@echo off
notepad.exe
call notepad.exe

In other words, "call" has no effect when used with .exe files.


Thanks, Pegasus .... that helps me a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top