0
votes

I'm trying to run a simple DOS command (pushed with relative path) in Groovy. "pfxFileFolde" is defined at test suite level as "${projector}/testfolder".

def pfxFileFolder = context.expand('${#TestCase#pfxFileFolder}')
String command = "cmd /c pushd "pfxFileFolder"";
Process child = Runtime.getRuntime().exec(command);

I got error:

groovy.lang.MissingMethodException: No signature of method: Script70.cmd /c pushd () is applicable for argument types: (java.lang.String) values: [/my/relative/path/testfolder] error at line: 37

I'm pretty new to JAVA, Groovy. How can I use Java def (relative path) with DOS commands in Groovy?

The below command works, so pfxFileFolder is correct. log.info pfxFileFolder

1

1 Answers

0
votes

Your quoting is wrong. Either use ' or quote your " with \":

String command = 'cmd /c pushd "pfxFileFolder"';

Already the syntax highlighting on here on SO makes this obvious.