【发布时间】:2021-03-09 02:28:52
【问题描述】:
我尝试通过 PowerShell 脚本创建一个快捷方式,并将以下值作为目标:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& '"C:\Program Files\Test\script.ps1"'"
这是我现有的脚本,它可以工作,但我无法在其中获得我想要的目标路径。
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("C:\Program Files\Test\test.lnk")
$Shortcut.TargetPath =
$Shortcut.WorkingDirectory = "C:\Program Files\Test\tool"
$Shortcut.Save()
我希望有人可以帮助我。
【问题讨论】:
标签: windows powershell command quotes