Home > Mobile >  How do I get the `run` command working on Windows 11?
How do I get the `run` command working on Windows 11?

Time:08-24

I wanted to try testing Raku code on Windows. I managed to get Windows 11 set up on VirtualBox and the Raku binary installed and I can execute scripts.

However, I cannot seem to get the simplest run command to do anything without returning an error:

run('ls');

results in:

The spawned command 'ls' exited unsuccessfully (exit code: 1, signal: 0)
  in block <unit> at .\test.txt line 5

I also tried with dir command, but had the same problem.

CodePudding user response:

There is no ls program on Windows by default, and dir is not an executable that can be run, but rather a Windows command shell built-in. You could try using shell instead of run, or instead try something like:

run 'cmd.exe', '/c', 'dir'

  • Related