Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to run 2 programs with Batch Commands

  1. #1
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts

    How to run 2 programs with Batch Commands

    I am writing a batch file with options to boot different types of server. I am stuck at booting first a dedicated server, then to parallel boot the client to that server. I am wondering if anyone knows the right syntax to do it.

    This is what I have right now:

    PHP Code:
    @echo off

    set color
    =04e
    color 
    %color%

    mode concols=80 lines=30

    goto START

    :START
    echo __________________________________________________________
    echo.
    echo 
    "  _____                             __  __           _  "
    echo " |  __ \                           |  \/  |         | | "
    echo " | |  | | ___ _ __ ___   ___  _ __ | \  / | ___   __| | "
    echo " | |  | |/ _ \ '_ \` _ \/ _ \| '_ \| |\/| |/ _ \ / _  | "
    echo " | |__| |  __/ | | | | | (_) | | | | |  | | (_) | (_| | "
    echo " |_____/ \___|_| |_| |_|\___/|_| |_|_|  |_|\___/ \__,_| "
    echo "                                                        "
    echo __________________________________________________________

    goto MAKEOPTIONS

    :MAKEOPTIONS
    echo __________________________________________________________
    echo.
    echo  
    Please select an option:
    echo    
    1. Listen Server
    echo    2. Dedicated Server
    echo    3. Developers Server
    echo.
    echo    
    0. Exit
    echo.
    set /p make_option=:
    set make_option=%make_option:~0,1%
    if 
    "%make_option%"=="1" goto LISTEN
    if "%make_option%"=="2" goto DEDICATED CLIENT
    if "%make_option%"=="3" goto DEVELOPER
    if "%make_option%"=="0" goto END
    goto START


    :LISTEN
    echo.
    echo.
    @echo 
    STARTING COD2 DEMONMOD LISTEN
    @echo off

    cd C
    :\Program Files (x86)\Activision\Call of Duty 2\
    CoD2MP_s.exe +set fs_game mods/demon +exec mp-server.cfg +set sv_punkbuster 0 +map_rotate
    goto END

    :DEDICATED
    echo.
    echo.
    @echo 
    STARTING COD2 DEMOMOD DEDICATED
    @echo off

    cd C
    :\Program Files (x86)\Activision\Call of Duty 2\
    CoD2MP_s.exe +set fs_game mods/demon +set dedicated 2 +set net_ip 86.26.148.175 +set net_port 28961 +exec mp-server.cfg +set sv_punkbuster 0 +map_rotate

    :CLIENT
    cd C
    :\Program Files (x86)\Activision\Call of Duty 2\
    CoD2MP_s.exe +connect 86.26.148.175:28961
    goto END

    :DEVELOPER
    echo.
    echo.
    @echo 
    STARTING COD2 DEMOMOD DEVELOPER
    @echo off

    cd C
    :\Program Files (x86)\Activision\Call of Duty 2\
    CoD2MP_s.exe +set fs_game mods/demon +set developer 1 +set developer_script 1 +exec mp-server.cfg +set sv_punkbuster 0 +map_rotate
    goto END


    :END
    EXIT 
    What happens is, when I pick option 2, the dedicated server starts no problem, but I have to shut the server down before :CLIENT is executed.

    Anyone know how to do it?

  2. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Tally View Post
    What happens is, when I pick option 2, the dedicated server starts no problem, but I have to shut the server down before :CLIENT is executed.

    Anyone know how to do it?
    Maybe it works with the parameter allowdupe. (CoD2MP_s.exe allowdupe +set fs_game mods/demon...)

    Edit: i get it now, you run the .bat and the code is still waiting until the application is finished and then it starts the other server.
    See this: http://stackoverflow.com/questions/8...ing-run-launch
    Last edited by Mitch; 10th February 2014 at 16:40.

  3. #3
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Mitch View Post
    Maybe it works with the parameter allowdupe. (CoD2MP_s.exe allowdupe +set fs_game mods/demon...)

    Edit: i get it now, you run the .bat and the code is still waiting until the application is finished and then it starts the other server.
    Yes, the batch code is waiting until the dedicated server is finished. Then, it starts :CLIENT. I want it to run BOTH at the same time. A parallel run command.

  4. #4
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    What about:

    Code:
    start CoD2MP_s.exe +set fs_game mods/demon +set dedicated 2 +set net_ip 86.26.148.175 +set net_port 28961 +exec mp-server.cfg +set sv_punkbuster 0 +map_rotate
    (http://stackoverflow.com/questions/8...ing-run-launch)

  5. #5
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    No, I tried that. In fact, when googling, that forum link came up. It still waits for the dedicated server to shut down before proceeding to launch the client to the server IP.

    I'm stumped. Been on it for 2 days now.

  6. #6
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Just tested it, this workes like a charm (basically just Mitchs suggestions merged )

    PHP Code:
    start CoD2MP_s.exe allowdupe +set dedicated 2 
    start CoD2MP_s
    .exe allowdupe +set dedicated 2 
    At least the second .exe needs "allowdupe", otherwise it will close itself.

    Info: tested on Win8
    timescale 0.01

  7. #7
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by kung foo man View Post
    Just tested it, this workes like a charm (basically just Mitchs suggestions merged )

    PHP Code:
    start CoD2MP_s.exe allowdupe +set dedicated 2 
    start CoD2MP_s
    .exe allowdupe +set dedicated 2 

    At least the second .exe needs "allowdupe", otherwise it will close itself.

    Info: tested on Win8
    Jesus! So simple!

    thanks guys

  8. #8
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    what does allowdupe do?

  9. #9
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    what does allowdupe do?
    Allows 2 or more instances of the same program.

  10. #10
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    But I can run multiple COD2's on my laptop without this command. Or is it something else?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •