Problem with shell in Windows

Hi, Julia newbie here.

In https://github.com/JuliaAcademy/DataScience, there are the lines:

using BenchmarkTools

using DataFrames

using DelimitedFiles

using CSV

using XLSX

println("I'm excited to learn Julia")

P = download("https://raw.githubusercontent.com/nassarhuda/easy_data/master/programming_languages.csv",

"programminglanguages.csv")

;wget "https://raw.githubusercontent.com/nassarhuda/easy_data/master/programming_languages.csv"

;head programminglanguages.csv

In VSC and Julia REPL, the lines above run fine up to the shell commands.

I am using Windows 10 and Julia 1.4.

“;” opens the shell fine, however

wget "https://raw.githubusercontent.com/nassarhuda/easy_data/master/programming_languages.csv"

head programminglanguages.csv

echo hello

all return similar errors

shell> echo hello

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 at .\process.jl:438 [inlined]

 [7] repl_cmd(::Cmd, ::REPL.Terminals.TTYTerminal) at .\client.jl:69

 [8] top-level scope at none:0

 [9] eval(::Module, ::Any) at .\boot.jl:331

 [10] eval_user_input(::Any, ::REPL.REPLBackend) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\REPL\src\REPL.jl:86

 [11] run_backend(::REPL.REPLBackend) at C:\Users\Isaia\.julia\packages\Revise\BqeJF\src\Revise.jl:1184

 [12] top-level scope at none:0

julia> ENV["PATH"]
returns my usual path statement.

All three commands work in WSL.

Both dir and ls give a similar error

Wondering how to get these shell commands to work?

Welcome to the Julia Community! See https://github.com/JuliaLang/julia/issues/23597

3 Likes

Thanks @Mattriks! My notes on where you directed me:

For windows commands:

cmd /c command # /C Carries out the command then terminates

eg cmd /c dir

eg cmd /c START notepad.exe

list for cmd:

ASSOC, BREAK, CALL, CD/CHDIR, CLS, COLOR, COPY, DATE, DEL, DIR, DPATH,

ECHO, ENDLOCAL, ERASE, EXIT, FOR, FTYPE, GOTO, IF, KEYS, MD/MKDIR,

MKLINK, MOVE, PATH, PAUSE, POPD, PROMPT, PUSHD, REM,

REN/RENAME, RD/RMDIR, SET, SETLOCAL, SHIFT, START, TIME, TITLE, TYPE,

VER, VERIFY, VOL

For Linux commands:

Add to path the Code.exe and julia.exe paths (I’m using VSC)
(in the windows search box, type path, select “edit the environment variables,”
Click the “environment variables” button. In “system variables” pane, double click “path”, click “new” button. Restart)

Launch git bash
$ Code
Or $ Julia

Or add git-bash.exe path to the path environment variable.
In cmd, git-bash -c Code,
Or create a short cut with target: “C:\Program Files\Git\git-bash.exe” -c Code
(Keep the git-bash window open)

1 Like
1 Like

Thanks @ PetrKryslUCSD! A shortcut with C:\WINDOWS\system32\cmd.exe /c start “” “%PROGRAMFILES%\Git\bin\sh.exe” --login -i -c “exec julia” as the target worked too