# Run(cmd) manual examples throw error

**URL:** <https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916>\
**Category:** New to Julia\
**Created:** [November 10, 2020, 2:11pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916 "2020-11-10T14:11:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derek\_Vetsch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derek_vetsch/32/8552_2.png) [@Derek\_Vetsch](https://discourse.julialang.org/u/Derek_Vetsch)\
**Post date:** [November 10, 2020, 2:11pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916/1 "2020-11-10T14:11:09Z")

</div>

In the examples from the manual section “Running External Programs”, I can’t seem to get the examples to work on my machine…

```julia
cmd = `echo hello`
run(cmd)

```

Here is the error:

```julia
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] #550 at .\process.jl:112 [inlined]
 [3] setup_stdios(::Base.var"#550#551"{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[9]:1

```

What am I missing?

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [November 10, 2020, 2:52pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916/2 "2020-11-10T14:52:06Z")

</div>

Looks like you are using Windows, and presumable there is no `echo` program to spawn.

---

<div class="post-metadata">

**Author:** ![Derek\_Vetsch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derek_vetsch/32/8552_2.png) [@Derek\_Vetsch](https://discourse.julialang.org/u/Derek_Vetsch)\
**Post date:** [November 10, 2020, 4:08pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916/3 "2020-11-10T16:08:47Z")

</div>

I am using windows - but if I put `echo hello` into the windows command prompt I receive expected echo?

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [November 10, 2020, 4:29pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916/4 "2020-11-10T16:29:45Z")

</div>

It is probably a shell builtin then and not a separate program. Try `cmd /c echo hello`.

---

<div class="post-metadata">

**Author:** ![Derek\_Vetsch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derek_vetsch/32/8552_2.png) [@Derek\_Vetsch](https://discourse.julialang.org/u/Derek_Vetsch)\
**Post date:** [November 12, 2020, 3:22pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916/5 "2020-11-12T15:22:30Z")

</div>

This prints hello as expected if I run it in cmd.exe, but if I use it as a command object in julia like so

```julia
cmd = `"""cmd /c echo hello"""`
run(cmd)

```

I receive the same error as above?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [November 12, 2020, 3:24pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916/6 "2020-11-12T15:24:45Z")

</div>

You shouldn’t have those `"""`s there:

```julia
julia> run(`cmd /c echo hello`)
hello
Process(`cmd /c echo hello`, ProcessExited(0))

```

---

<div class="post-metadata">

**Author:** ![Derek\_Vetsch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/derek_vetsch/32/8552_2.png) [@Derek\_Vetsch](https://discourse.julialang.org/u/Derek_Vetsch)\
**Post date:** [November 12, 2020, 3:25pm UTC](https://discourse.julialang.org/t/run-cmd-manual-examples-throw-error/49916/7 "2020-11-12T15:25:50Z")

</div>

Many thanks!
