# Julia shell and Windows shell (cmd) giving different result

**URL:** <https://discourse.julialang.org/t/julia-shell-and-windows-shell-cmd-giving-different-result/84053>\
**Category:** General Usage\
**Created:** [July 11, 2022, 3:05pm UTC](https://discourse.julialang.org/t/julia-shell-and-windows-shell-cmd-giving-different-result/84053 "2022-07-11T15:05:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brad\_Carman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brad_carman/32/17631_2.png) [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Post date:** [July 11, 2022, 3:05pm UTC](https://discourse.julialang.org/t/julia-shell-and-windows-shell-cmd-giving-different-result/84053/1 "2022-07-11T15:05:37Z")

</div>

I am attempting to call `xelatex` from Julia’s `run()` function. For some reason I am getting a missing fonts error when running this from Julia. When running the same command (from the same location) in Windows cmd, the document builds fine.

What could possibly be the difference between Julia’s shell and cmd???

Here’s some details…

```julia
julia> pwd()
"c:\\Work\\IST\\Projects\\JuliaPackages\\BuildAndBenchmark.jl\\tex\\CatapultModel\\systemerror"

shell> systemerror.bat

c:\Work\IST\Projects\JuliaPackages\BuildAndBenchmark.jl\tex\CatapultModel\systemerror>xelatex -shell-escape systemerror.tex 
This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021/W32TeX) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
.
.
.
kpathsea: Running mktexmf FreeSerif.mf

The command name is C:\Programs\texlive\2021\bin\win32\mktexmf
name = FreeSerif, rootname = FreeSerif, pointsize =
mktexmf: empty or non-existent rootfile!
Cannot find FreeSerif.mf.

```

Now running in cmd:

```julia
C:\Work\IST\Projects\JuliaPackages\BuildAndBenchmark.jl\tex\CatapultModel\systemerror>systemerror.bat

C:\Work\IST\Projects\JuliaPackages\BuildAndBenchmark.jl\tex\CatapultModel\systemerror>xelatex -shell-escape systemerror.tex 
This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021/W32TeX) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
.
.
.
Output written on systemerror.pdf (23 pages).
Transcript written on systemerror.log.

```

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [July 11, 2022, 3:23pm UTC](https://discourse.julialang.org/t/julia-shell-and-windows-shell-cmd-giving-different-result/84053/2 "2022-07-11T15:23:27Z")

</div>

The shell mode in the REPL isn’t really a shell.

> [@Documentation for shell mode?](https://discourse.julialang.org/t/documentation-for-shell-mode/55564):
>
> I really like the REPL’s shell mode (the thing you get after typing ;). But I struggle with understanding which features of my normal $SHELL are available, and which don’t work. I’ve read [the official docs](https://docs.julialang.org/en/v1/stdlib/REPL/#man-shell-mode), but I can’t find the answers to these questions: Why aren’t the aliases I define in my e.g. ~/.zshrc available? Can I do any job control (run things in the background with &, etc.)? Why can’t I set shell variables? Is there anywhere I can find the answers to this questions? I run Julia on…

---

<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:** [July 11, 2022, 3:55pm UTC](https://discourse.julialang.org/t/julia-shell-and-windows-shell-cmd-giving-different-result/84053/3 "2022-07-11T15:55:38Z")

</div>

If you NEED to run a Windows CMD process in Julia, using `shell> cmd /c <cmd>` instead of `shell> <cmd>` (for example) seems to solve a lot of problems. If you were to prefix each line of your `.bat` file with that, I wonder if you would have better luck?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 11, 2022, 4:03pm UTC](https://discourse.julialang.org/t/julia-shell-and-windows-shell-cmd-giving-different-result/84053/4 "2022-07-11T16:03:57Z")

</div>

Run Julia from a git bash. The environment settings should be sane(r).

---

<div class="post-metadata">

**Author:** ![Brad\_Carman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brad_carman/32/17631_2.png) [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Post date:** [July 11, 2022, 5:47pm UTC](https://discourse.julialang.org/t/julia-shell-and-windows-shell-cmd-giving-different-result/84053/5 "2022-07-11T17:47:49Z")

</div>

OK, that did the trick! Actually it seems to work in other instances of Julia started from git bash or from cmd or from VS Code terminal. So just my current running session fails for some reason. Wish I could understand why, but I guess maybe some environment variable that is needed is set different in my current running instance.
