# Solved: Outlook Batch File



## computerman29642 (Dec 4, 2007)

I have a batch file that opens outlook when I login into the computer. The code below is what I have within the batch file:


```
start outlook.exe /m
```
Is there a way to modify the code to wait until the system has come up fully before executing?


----------



## TheOutcaste (Aug 8, 2007)

Without using a 3rd party application to delay startup, you can always just add a delay in the batch file:
ping 192.168.255.1 -n 1 -w *X*000

Where X is the number of seconds you want to wait, so 60000 would wait 60 seconds.
The address you ping must be one that does not exist, so if you just happen to be using the 192.168.255.X range, you 'll need to change that, or make sure it's not a valid IP.

HTH

Jerry


----------



## computerman29642 (Dec 4, 2007)

Thanks Jerry.


----------



## computerman29642 (Dec 4, 2007)

Jerry, could I use this IP Address 127.0.0.1?


----------



## devil_himself (Apr 7, 2007)

computerman29642 said:


> Jerry, could I use this IP Address 127.0.0.1?


yes

*ping -n 5 localhost*

check out
http://en.wikipedia.org/wiki/Localhost

localhost always translates to the loopback IP address 127.0.0.1 in IPv4, or ::1 in IPv6


----------



## computerman29642 (Dec 4, 2007)

Is there a way to have the batch to wait until the system is fully up before executing?


----------



## devil_himself (Apr 7, 2007)

computerman29642 said:


> Is there a way to have the batch to wait until the system is fully up before executing?


No ..


----------



## computerman29642 (Dec 4, 2007)

I have the following code...


```
ping 127.0.0.1 -n 1 -w 120000
start outlook.exe /m
```
I thought that Outlook would wait 2 minutes before opening, but it opens right away. What am I doing wrong?


----------



## devil_himself (Apr 7, 2007)

use this

```
ping -n 120 localhost > nul
start outlook.exe /m
```


----------



## computerman29642 (Dec 4, 2007)

That worked, thanks.


----------



## TheOutcaste (Aug 8, 2007)

computerman29642 said:


> I have the following code...
> 
> 
> ```
> ...





TheOutcaste said:


> The address you ping must be one that does not exist


the -w (wait) switch tells ping how long to wait for a reply. If the address responds, the wait parameter has no affect. with th -n 1 parameter it only sends one ping, so the wait tiime will be only 1 second. If you want to use an address that responds then use -n (number of packets to send) as devil_himself has indicated. Each ping takes approximately 1 second.

Either method will work. Just a matter of preference.

Pinging the localhost address doesn't send any packets over the network, but the network card is sending and receiving the packets internally (60 bytes each, 120 bytes per ping) so it could possibly have a slight effect on sending/receiving other data, but it's not too likely.

Pinging a non-existent address sends one 60 byte packet, then waits for a timer to timeout, so the network card isn't actually processing any data. Timing with this method also _seems_ to be less affected by other processes hogging processor time, but I have no real data to prove that one way or the other.

Jerry


----------



## computerman29642 (Dec 4, 2007)

Thanks Jerry for the explanantion. I am going to test both methods.


----------

