How to run a command with a different working directory?

Viewed 152

In Deno, I know that I can run a command like so:

const process = Deno.run({
  cmd: ["echo", "hello world"]
})

How can I run my command with a different working directory?

1 Answers

Use cwd to specify a different path relative to your working directory (or use an absolute path).

const process = Deno.run({
  cmd: ["echo", "hello world"],
  cwd: "/path/to/dir"
})
Related