命令
Cmd
Cmd
是Julia中表示指令的数据类型,使用一对``
定义,例如`cd ../`
用构造函数Cmd(cmd::Cmd; ignorestatus=false, detach=false, windows_verbatim=false, windows_hide=false, env, dir)
定义状态,其中
ignorestatus 为true时,命令返回值非0不会抛出异常
detach 为true时,产生新进程运行
windows_verbatim 为true时,将把字符串原封不动传递
windows_hide 为true时,在一个允许窗口且没有打开窗口环境下仍不生成新窗口
env 设置环境变量
dir 设置默认文件夹
使用run(cmd)
运行指令,使用run(cmd1 & cmd2 ... &cmdn)
并行运行命令
要读取指令结果,可以使用read(cmd)
(得到Vector{UInt8}
数组)或read(cmd, String)
得到字符串
Base.OrCmds
参阅管道