1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Outlook Batch File

Discussion in 'DOS/Other' started by computerman29642, Oct 6, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    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:

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

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    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 X000

    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
     
  3. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    Thanks Jerry. :)
     
  4. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    Jerry, could I use this IP Address 127.0.0.1?
     
  5. devil_himself

    devil_himself

    Joined:
    Apr 7, 2007
    Messages:
    4,910
    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
     
  6. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    Is there a way to have the batch to wait until the system is fully up before executing?
     
  7. devil_himself

    devil_himself

    Joined:
    Apr 7, 2007
    Messages:
    4,910
    No ..
     
  8. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    I have the following code...

    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?
     
  9. devil_himself

    devil_himself

    Joined:
    Apr 7, 2007
    Messages:
    4,910
    use this
    Code:
    ping -n 120 localhost > nul
    start outlook.exe /m
    
     
  10. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    That worked, thanks.
     
  11. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    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
     
  12. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    Thanks Jerry for the explanantion. I am going to test both methods.
     
  13. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/756595

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice