Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > dos %x{..} and my nUUbness

Reply
Thread Tools

dos %x{..} and my nUUbness

 
 
John Hager
Guest
Posts: n/a
 
      07-13-2005
------=_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--


 
Reply With Quote
 
 
 
 
Gavin Kistner
Guest
Posts: n/a
 
      07-13-2005
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 }


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IOS DoS defense causes DoS to itself:) Igor MamuziŠ Cisco 2 05-19-2006 11:59 PM
Outsmarting DOS C compiler to print to USB printer -- use DOS interrupt? tomhr C Programming 27 01-12-2006 04:09 PM
[newbie]How to install python under DOS and is there any Wxpython can be installed under dos? john san Python 19 02-18-2005 12:05 PM
Unable to run MS-DOS in Windows and DOS properties tabs missing Don Computer Support 5 02-11-2004 07:20 PM
Executing DOS (yes, DOS) program from within Python? Ben Fairbank Python 2 10-07-2003 08:51 AM



Advertisments