在julia中运行run(`code`)报错

Windows环境,直接在终端中使用code命令可以打开VScode,但是在Julia里面使用

run(`code`)

会报如下错误

ERROR: IOError: could not spawn `code`: no such file or directory (ENOENT)
Stacktrace:
 [1] _spawn_primitive(file::String, cmd::Cmd, stdio::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
   @ Base .\process.jl:128
 [2] #760
   @ .\process.jl:139 [inlined]
 [3] setup_stdios(f::Base.var"#760#761"{Cmd}, stdios::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
   @ Base .\process.jl:223
 [4] _spawn
   @ .\process.jl:138 [inlined]
 [5] run(::Cmd; wait::Bool)
   @ Base .\process.jl:479
 [6] run(::Cmd)
   @ Base .\process.jl:477
 [7] top-level scope
   @ REPL[1]:1

但是使用notepad命令时没有遇到这个问题,请问有什么解决办法吗?

run(`code.cmd`) 可以

1 个赞