当我运行以下 powershell 工作流程时:
Function Start-LocalRScript {
Param([Parameter(ValueFromPipeline, Mandatory)]$Name)
$ScriptPath = "C:\Exploration.RScripts"
$RScriptExePath = "C:\Program Files\R\R-3.1.2\bin\Rscript.exe"
$scriptPath = Join-Path -Path $ScriptPath -ChildPath $Name
& $RScriptExePath $scriptPath
}
Workflow Get-RScriptWorkflow {
Start-LocalRScript script1.R
}
我收到以下错误,但我仍然得到 R 脚本的结果:
Rscript.exe : '\\srvuser01\profil\myUser\Documents' At Get-RScriptWorkflow:2 char:2
+ CategoryInfo : NotSpecified ('\\srvuser01\profil\myUser\Documents':String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : [localhost]
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
[1] "from script 1"
但是当我运行命令Start-LocalRScript script1.R
时没有错误。即使我指定了 RScript.exe 在脚本上的位置,工作流似乎也在尝试访问 RScript.exe 的网络中我的用户的本地路径Start-LocalRScript
。有谁知道这里发生了什么?