vadivelu
vadivelu

Reputation: 142

How to send values into command prompt from groovy?

I tried to pass an command or value at runtime into command prompt from groovy script. could anyone help on this ?

Upvotes: 0

Views: 452

Answers (1)

Bhanuchander Udhayakumar
Bhanuchander Udhayakumar

Reputation: 1621

Put your command in an Array: then use execute () to run as in command prompt like shown below.

def command = ['ls']
command.execute()

I feel like you are looking for a method like this: Use this method.

void executejar (String jarname)
{
   def command = ['java','-jar', jarname ]
   println command.execute().text
}

Upvotes: 1

Related Questions