Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

execute .bat file using post function in jira

Pooja Goudappanour March 18, 2021

Hi, new to JIRA here.

I want to execute .bat file from local disk, as postfuction( 'run script' script runner)

please suggest if i can execute .bat file?

tried this: def proc = "c:\\users\\40013750\\test.bat".execute();

failed:

g.codehaus.groovy.runtime.InvokerInvocationException: java.io.IOException: Cannot run program "c:\users\40013750\test.bat": error=2, No such file or directory at ConsoleScriptExecution1_groovyProxy.run(Unknown Source) Caused by: java.io.IOException: Cannot run program "c:\users\40013750\test.bat": error=2, No such file or directory at Script1.run(Script1.groovy:1) at Script1$run.call(Unknown Source) at Script1$run.call(Unknown Source) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:33) at com.adaptavist.sr.cloud.events.ScriptExecution.run(ScriptExecution.groovy:29) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at ConsoleScriptExecution1_groovyProxy.run(Unknown Source) at com.adaptavist.sr.cloud.MainHandler.executeScript(MainHandler.groovy:388) at com.adaptavist.sr.cloud.MainHandler.processInput(MainHandler.groovy:334) at com.adaptavist.sr.cloud.MainHandler.access$0(MainHandler.groovy) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure1.doCall(MainHandler.groovy:154) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure1.call(MainHandler.groovy) Caused by: java.io.IOException: error=2, No such file or directory ... 14 more

 

 

 

 

1 answer

0 votes
Mohamed Adel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2021

Hi @Pooja Goudappanour 

I think you need to use the following format

def urbatname = new File(c:\\users\\40013750\\test.bat).absolutePath

below you can find more detail about the fix

How-to-read-or-write-into-a-file-using-scriptrunner 

Pooja Goudappanour
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2021

Hi @Mohamed Adel 

Thank you!, But it's given the path of file, but did not open .bat from cmd...

is there something that i need to do to integrate between cmd and jira to execute this .bat file (before this line - def urbatname = new File(c:\\users\\40013750\\test.bat).absolutePath )?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events