无法在 onedrive 路径中使用 Start-Process powershell.exe 运行 一个 ps1 文件

can't using Start-Process powershell.exe run a ps1 file at onedrive path

我在 Onedrive for Business 路径中有一个 ps1 文件。当 运行 下面的命令时,它出错了,但它运行得太快了,我无法获得错误截图。 如果我将脚本放在另一个本地驱动器路径中,它就可以正常工作。 Onedrive 中有任何预防措施吗?

Start-Process powershell.exe -ArgumentList $ps1path

ps 文件内容

$current_path = Split-Path -Parent $MyInvocation.MyCommand.Definition
$up1_path = Split-Path -Parent $current_path
$up2_path = Split-Path -Parent $up1_path
$up1_path
$up2_path

cmd /c "pause"

这不是 Onedrive 案例。只是启动进程不能接受 ArgumentList 中的 space。

$pspath = $pspath -replace ' ','` '
Start-Process powershell.exe -ArgumentList $pspath