Changing the working directory when using the exec function in Rascal

Viewed 67

I am executing a command in Rascal on Windows 10 (some batch file) which in itself works fine:

import util::ShellExec;
exec("somecommand.bat");

This batch file does some file reads and writes in the current working directory. Through some debugging I have found that the default working directory (|cwd:///|) is C:\Program Files\Eclipse and this directory requires elevated rights to be able to write in it. I am trying to change the working directory when executing the command like so:

exec("somecommand.bat", |tmp:///|);

I have tried many variations of directories, but they all produce a CallFailed error without much detail.

How can I execute a command in a different working directory?

1 Answers

The working dir parameters is a so called "keyword parameter" which you call using this syntax:

exec(command, workingDir=|file:///myworkingdir|)
Related