# Why \`\`julia -e\`\` does not work on Windows?

**URL:** <https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195>\
**Category:** General Usage\
**Created:** [December 3, 2022, 10:52pm UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195 "2022-12-03T22:52:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 3, 2022, 10:52pm UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195/1 "2022-12-03T22:52:17Z")

</div>

```julia
C:\Users\joaqu\zzz>julia -e "using Pkg; Pkg.activate(".")"
ERROR: syntax: invalid identifier name "."
Stacktrace:
 [1] top-level scope

```

but no problem on Linux

```julia
j@Marilu:~/aaa$ julia -e 'using Pkg; Pkg.activate(".");'
  Activating new project at `~/aaa`

```

---

<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:** [December 3, 2022, 11:09pm UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195/2 "2022-12-03T23:09:34Z")

</div>

> [@joa-quim](#):
>
> `julia -e "using Pkg; Pkg.activate(".")"`

Since you use the same quotes both around and inside the string in this case it looks like your shell interprets this as executing the code `using Pkg; Pkg.activate(.)`. You would get the same error trying that exact code in Bash too. Perhaps you can escape the inner quotes as `\"`, or use single quotes just like in the Bash example (I don’t have access to a Cmd shell so can not test).

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 3, 2022, 11:16pm UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195/3 "2022-12-03T23:16:54Z")

</div>

Thanks, That is it.  
I had tried all variations I could think of for `julia -e \"...\"`, `julia -e ' ...'`, ``julia -e ` …``` but missed the obvious solution.

Strange that this has not shown up yet (that I remember or could find with search)

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [December 4, 2022, 2:06am UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195/4 "2022-12-04T02:06:40Z")

</div>

There was a related question recently:

> [@How to interpolate into the \`julia -c\` shell command](https://discourse.julialang.org/t/how-to-interpolate-into-the-julia-c-shell-command/90883/3):
>
> The standard solution is to quote variables (which you should always do anyway), not to hack IFS: julia -e "${code}"

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 4, 2022, 2:13am UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195/5 "2022-12-04T02:13:23Z")

</div>

That’s not entirely related: the problem here was that the code was quoted incorrectly.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 4, 2022, 2:19am UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195/6 "2022-12-04T02:19:38Z")

</div>

For reference, the bit of code I posted is part of a GH action to build a Franklin site and I was trying to make it work from Windows.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 4, 2022, 2:32am UTC](https://discourse.julialang.org/t/why-julia-e-does-not-work-on-windows/91195/7 "2022-12-04T02:32:24Z")

</div>

I’m pretty sure that syntax is wrong also in bash and all other Unix shells I know.
