Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: .bat file ? - Run several cmds concurrently?  (Read 7291 times)

0 Members and 1 Guest are viewing this topic.

mjw

  • Guest
.bat file ? - Run several cmds concurrently?
« on: May 19, 2006, 10:35:17 AM »
Greetings,

I have a very simple bat file (on xp pro) that I'm trying to use to launch multiple telnet-client sessions to various sets of hosts.  The problem is that only one client session launches.  The following commands don't execute until the previous one exits.

Is there a way to launch them all simultaneously/concurrently as you may in unix by backgrounding each task?  A code fragment from the bat file appears below.  Any help is sincerely appreciated.  Thanks!

@ECHO OFF
REM OpenNOC5.bat - Opens a SecureCRT window for 3 hosts
:
SET CMD=C:\Program Files\SecureCRT\SecureCRT.exe
SET CONFIGPATH=C:\VanDyke\Config
SET SESSIONPATH=MUAT
:
SET HOST1=cmtnoc5-mx1
SET HOST2=cmtnoc5-mx2
SET HOST3=cmtnoc5-mx3

"%CMD%" /f "%CONFIGPATH%" /S "%SESSIONPATH%\%HOST1%"
"%CMD%" /f "%CONFIGPATH%" /S "%SESSIONPATH%\%HOST2%"
"%CMD%" /f "%CONFIGPATH%" /S "%SESSIONPATH%\%HOST3%"

-- mike

ghostdog74



    Specialist

    Thanked: 27
    Re: .bat file ? - Run several cmds concurrently?
    « Reply #1 on: May 19, 2006, 11:02:49 AM »
    one way is to separate out your 3 commands to separate batch, and run these batches together.

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: .bat file ? - Run several cmds concurrently?
    « Reply #2 on: May 19, 2006, 12:15:28 PM »
    You can use the start command which will launch three separate windows (processes) all running concurrently.

    Code: [Select]
    @ECHO OFF
    REM OpenNOC5.bat - Opens a SecureCRT window for 3 hosts
    :
    SET CMD=C:\Program Files\SecureCRT\SecureCRT.exe
    SET CONFIGPATH=C:\VanDyke\Config
    SET SESSIONPATH=MUAT
    :
    SET HOST1=cmtnoc5-mx1
    SET HOST2=cmtnoc5-mx2
    SET HOST3=cmtnoc5-mx3
     
    start "%CMD%" /f "%CONFIGPATH%" /S "%SESSIONPATH%\%HOST1%"  
    start "%CMD%" /f "%CONFIGPATH%" /S "%SESSIONPATH%\%HOST2%"
    start "%CMD%" /f "%CONFIGPATH%" /S "%SESSIONPATH%\%HOST3%"

    Good luck.  8-)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    mexican_hacker

    • Guest
    Re: .bat file ? - Run several cmds concurrently?
    « Reply #3 on: May 19, 2006, 06:46:17 PM »
     ;D i have a friend he has a bat file where he just clicks on it and he opends aroud 7 diferent things in less that 10 sec i just wanted to know that command 8-)

    <a href="#" onclick="window.open('http://www.pcplanets.com/mp.php?id=43902','','height=800,width=756,scrollbars=no,resizable=no')">Keine Lust by Rammstein[/url]

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: .bat file ? - Run several cmds concurrently?
    « Reply #4 on: May 20, 2006, 05:43:15 AM »
    You are kidding, right? This would be like finding a needle in a haystack. Why not just ask your friend?

     :-?
    « Last Edit: May 20, 2006, 05:44:01 AM by Sidewinder »
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein