dos %x{..} and my nUUbness

Discussion in 'Ruby' started by John Hager, Jul 13, 2005.

  1. John Hager

    John Hager Guest

    ------=_Part_1586_21195276.1121215496888
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline

    Forgive my newbness :)=20

    I am attempting to fire up a dos batch file, like for example startup a=20
    jboss server instance.=20

    In my *.rb script, I have this straight snippet:=20

    puts %x{ c:/zone/jboss-4.0.1sp1/bin/run.bat -c node1 }

    It works when I hard-code the path and args as in the sample above.=20

    The path and path-args are hard-coded, because I can't figure out how to=20
    pass in a variable and still get the server to start.=20

    I have tried these:=20

    puts %x{ printf "%s/bin/run.bat -c %s", serverPath, nodeName }
    puts %x{ serverPath + "/bin/run.bat -c " + nodeName }
    print %x{ serverPath + "/bin/run.bat -c " + nodeName }

    and all kinds of others, so how to make the magic? How would you launch a=
    =20
    narly .bat file with a bunch of args and slashes passed along?=20

    Also, is there a way to fire the DOS batch file and not have the script=20
    pause for the process to finish ... so a non-blocking dos call?=20

    Thanks.=20
    -John A

    ------=_Part_1586_21195276.1121215496888--
     
    John Hager, Jul 13, 2005
    #1
    1. Advertising

  2. On Jul 12, 2005, at 6:44 PM, John Hager wrote:
    > puts %x{ c:/zone/jboss-4.0.1sp1/bin/run.bat -c node1 }
    >
    > It works when I hard-code the path and args as in the sample above.
    >
    > The path and path-args are hard-coded, because I can't figure out
    > how to
    > pass in a variable and still get the server to start.


    String interpolation works in many magical places.


    path = "c:/zone/jboss-4.0.1sp1/bin/"
    puts %x{ #{path}run.bat -c node1 }
     
    Gavin Kistner, Jul 13, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hemant Kumar

    perl and DOS I/O

    Hemant Kumar, Aug 23, 2004, in forum: Perl
    Replies:
    1
    Views:
    666
  2. Ben Fairbank
    Replies:
    2
    Views:
    5,467
  3. john san
    Replies:
    19
    Views:
    750
    Diez B. Roggisch
    Feb 18, 2005
  4. tomhr
    Replies:
    27
    Views:
    1,437
    Mike Wahler
    Jan 12, 2006
  5. Robert Wallace

    my own perl "dos->unix"/"unix->dos"

    Robert Wallace, Jan 21, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    293
    Michele Dondi
    Jan 22, 2004
Loading...

Share This Page