我有一个场景,我需要将 powershell 路径构建为$RemotePath = '$($env:USERPROFILE)\Desktop\Shell.lnk'. 这个变量被传递到需要执行的远程机器。远程机器将其作为字符串变量接收。如何扩展要评估的字符串$env:USERPROFILE?
$RemotePath = '$($env:USERPROFILE)\Desktop\Shell.lnk'
$env:USERPROFILE
powershell remote-execution variable-expansion
powershell ×1
remote-execution ×1
variable-expansion ×1