2

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?

diggingforfire
  • 3,359
  • 1
  • 23
  • 33

1 Answers1

2

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

exec(command, workingDir=|file:///myworkingdir|)
Jurgen Vinju
  • 6,393
  • 1
  • 15
  • 26