Announcement

Collapse
No announcement yet.

.bat script help^^

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • .bat script help^^

    Hey i know bits and pieces of scripting from all over the place.

    My question is .. for a bat file.. its referring to a game i play.. I want to launch 2 clients at the using a bat file. Heres how i launch just one. Its pretty simple.

    @echo off
    Neuz.exe Sunkist

    But if i wanted to make the bat file launch 2 of them.
    What do i do.

    And if you know by last question is, well how do u adjust the time between when they open.

    Say i was able to launch 2 of them.
    Would there be a way of putting time between them. IE.

    @echo off
    Neuz.exe Sunkist
    >>>>>>>>(3 Seconds)<<<<<<<<<<<<<<<
    @echo off
    Neuz.exe Sunkist

    Thanks for your time. Dont get angry at me cause im pretty bad at this.
    Just need a friendly face to help me out.

    JT

  • #2
    Re: .bat script help^^

    For a 5 seconds delay once, simply add this line to your batch;
    PING 127.0.0.1 -n 6 >Nul
    (http://www.robvanderwoude.com/wait.html)

    An other option is to use the sleep function from vbs within your batch.
    Therefor a small separate temp vbsfile is created at the beginning of your batch.
    Then this temp vbsfile can be called from your batch ( %WaitMiliSeconds% 3000 ) every time you want the batch to Wait.

    Code:
    @echo off
    (Set WaitMiliSeconds=start/b/w cscript.exe //NoLogo "%temp%.\Wait.vbs")
    > "%temp%.\Wait.vbs" echo.On Error Resume Next
    >>"%temp%.\Wait.vbs" echo.Wscript.sleep wScript.Arguments(0)
    ::---------------------------------------------------------------------
    
    rem : The lines above must be at the beginning of the batch.
    
    rem : The line below you can use as many times you need a 'wait' in the batch.
    rem : the number is the time in miliseconds that the batch will wait.
    
    %WaitMiliSeconds% 5000
    
    rem : the line below is at the end of the batch
    DEL "%Temp%.\Wait.vbs"
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: .bat script help^^

      I'd probably keep it extremely simple myself

      Code:
      @ECHO off
      Neuz.exe Sunkist
      sleep 3
      Neuz.exe Sunkist
      You don't need the @ECHO off the second time. You could also insert a "wait" which would require you to press any key to move forward on the next run.


      Code:
      @ECHO off
      Neuz.exe Sunkist
      wait
      Neuz.exe Sunkist
      Just how I'd do it IMO only because it's hard for me to think about how many miliseconds there are in a second but of course if you want more accurate time maybe that'd be better

      Issues you might run into:
      Vista has replaced the sleep command.
      Alot of times when you run a batch file to open a file the batch will pause until you close the file. Probably the best way to compensate for this would be to open a second command window.

      Example: you would need to batch files call Neuz1.bat and Neuz2.bat

      first command window Neuz1.bat
      Code:
      @ECHO off
      start Neuz2.bat
      Neuz.exe Sunkist
      Second command window Neuz2.bat
      Code:
      @ECHO off
      sleep 3
      Neuz.exe Sunkist
      Last edited by Gryz; 2nd April 2008, 13:57.

      Comment


      • #4
        Re: .bat script help^^

        Unless we're dealing with a very old OS, the OP doesn't have wait or sleep available to use. But you can install the Windows Server 2003 Resource Kit Tools and then one could use the sleep command.
        Regards,
        Jeremy

        Network Consultant/Engineer
        Baltimore - Washington area and beyond
        www.gma-cpa.com

        Comment

        Working...
        X