【问题标题】:Run windows CMD in R在 R 中运行 windows CMD
【发布时间】:2018-12-24 14:39:43
【问题描述】:

我是 R 的初学者。如果这个问题对你来说听起来很幼稚,请原谅我。

我需要使用 Windows CMD 在R studio 中运行以下命令。

copy *.txt combinedfiles.txt

这个命令实际上是在WindowsCMD中将所有文件合并为一个文件。

我尝试使用system() 和system2()。但我无法得到结果。 例如:

system(cmd.exe copy *.txt combinedfiles.txt)

请帮我解决这个问题。

【问题讨论】:

  • cmd /c <command>。见cmd /?。

标签: r windows cmd rstudio


【解决方案1】:

copy 不是独立程序,而是 Windows 命令行解释器的内置命令。要运行它,请在 R 中使用 shell。

shell("copy *.txt combinedfiles.txt")

【讨论】:

    猜你喜欢
    • 2014-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-28
    • 2018-07-09
    • 2012-12-07
    • 2023-03-08
    • 2022-01-18
    相关资源
    最近更新 更多