有没有办法确定在 Profile 脚本中传递给 powershell 可执行文件的参数是什么?
我想检查是否设置了工作目录参数,然后cd在我的用户配置文件中用我自己的参数覆盖它。
我做了一些无助的尝试来从配置文件脚本中获取变量值,但没有成功。它们似乎都没有给我任何关于是否pwsh.exe使用-wd参数调用的信息:
echo $PSBoundParameters
echo $ArgumentList
echo (Get-Variable MyInvocation -Scope 0).Value;
Run Code Online (Sandbox Code Playgroud) powershell ×1