命令在powershell中工作,但不通过system()/system2()/shell()工作?
我希望从R运行powershell命令。它在powershell中工作,但我无法使它在R中工作 这在powershell中有效命令在powershell中工作,但不通过system()/system2()/shell()工作?,r,powershell,R,Powershell,我希望从R运行powershell命令。它在powershell中工作,但我无法使它在R中工作 这在powershell中有效 [guid]::NewGuid() 但这些都不适用于R system("[guid]::NewGuid()", intern=TRUE) system2("[guid]::NewGuid()") shell("[guid]::NewGuid()") 有什么想法吗?我想你需要告诉system()你想使用pow
[guid]::NewGuid()
但这些都不适用于R
system("[guid]::NewGuid()", intern=TRUE)
system2("[guid]::NewGuid()")
shell("[guid]::NewGuid()")
有什么想法吗?我想你需要告诉
system()
你想使用powershell
而不是cmd
作为可执行文件
假设powershell在您的路径变量中,请尝试
system('powershell -command "[guid]::NewGuid()"', intern=TRUE)
您也可以尝试离开intern=TRUE
,具体取决于您期望的输出类型