[英]Setting Directory of command prompt
I would like to set the working directory of the command prompt using the function system2
in R and I got the following error: 我想在R中使用功能system2
设置命令提示符的工作目录,但出现以下错误:
system2("cmd.exe", args = paste("cd", "Users/AKatherine/Downloads", sep = " "))
'Akatherine' is not recognized as an internal or external command, operable program or batch file. “ Akatherine”未被识别为内部或外部命令,可操作程序或批处理文件。
Also, I tried to run this 另外,我尝试运行
system2("cmd.exe", args = "java -mx150m -cp "*;" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat "penn,typedDependencies" -outputFormatOptions "basicDependencies" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ./Test/input.txt")
and got the following error: 并得到以下错误:
Error: unexpected ';' 错误:意外的';' in "system2("cmd.exe", args = "java -mx150m -cp "*;" 在“ system2(” cmd.exe“,args =” java -mx150m -cp“ *;”
Do anyone know why? 有人知道为什么吗? Can anyone help me with this? 谁能帮我这个?
For the second part of my question, I tried using the shell
function instead of the system2
function and I got the same output that I observe when I type in the same command in the command prompt. 对于问题的第二部分,我尝试使用shell
函数而不是system2
函数,并且得到与在命令提示符下键入相同命令时观察到的相同输出。 I used: 我用了:
shell(cmd = "java -mx150m -cp \"*;\" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat \"penn,typedDependencies\" -outputFormatOptions \"basicDependencies\" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ./Test/input.txt", shell = "cmd.exe")
instead of 代替
system2("cmd.exe", args = "java -mx150m -cp \"*;\" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat \"penn,typedDependencies\" -outputFormatOptions \"basicDependencies\" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ./Test/input.txt")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.