2017-10-04 11 views
0

나는 다음과 같은 PowerShell을 워크 플로우 실행하면 :UNC 오류

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. 아무도 여기서 무슨 일이 일어나는 지 알아?

답변

0

대신 Start-Process을 사용하고 -WorkingDirectory을 올바른 작업 디렉토리로 설정하십시오.