Run command error in Windows 10

I was going through the examples in Running External Programs · The Julia Language and found some that worked on a Raspberry Pi but errored on Windows 10. In both instances I was working from the REPL.

mycommand = echo hello works just fine on each system

run(mycommand) works as expected on the Raspberry Pi installation but throws an error on Windows

julia> run(mycommand)
ERROR: IOError: could not spawn echo hello: no such file or directory (ENOENT)
Stacktrace:
[1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at .\process.jl:99
[2] #585 at .\process.jl:112 [inlined]
[3] setup_stdios(::Base.var"#585#586"{Cmd}, ::Array{Any,1}) at .\process.jl:196
[4] _spawn at .\process.jl:111 [inlined]
[5] run(::Cmd; wait::Bool) at .\process.jl:439
[6] run(::Cmd) at .\process.jl:438
[7] top-level scope at REPL[22]:1

Any ideas?

There is no program echo on Windows, see e.g. Run(cmd) manual examples throw error.

Should probably be more explicit about this in the manual since apparently many users misunderstands this.

3 Likes

at the command prompt of Windows I type

echo hello
and it responds with
hello

echo /? gives the usage of echo in Win 10.

echo is an internal command of cmd, not a callable executable in Windows.
Look at the solution to link provided in previous post.

1 Like

You are vaguely reviving my DOS memories. I understand now, and agree that the documentation should mention the internal commands vs. the external ones that are callable and give the example from the previous post…

1 Like