【发布时间】:2012-03-20 19:07:55
【问题描述】:
简短而甜蜜,我正在 PS 中制作快捷方式,只要目标路径中没有空格,快捷方式就可以正常工作。一旦目标中有一个空格,快捷方式目标就会用双引号括起来,因此不起作用......下面是非工作代码。如果你要删除它会正确的空间(除了它当时没有指向EXE的事实)。基本上它不会将目标用引号括起来。
$shell = New-Object -ComObject WScript.Shell
$shortcutX = $shell.CreateShortcut("C:\Short.lnk")
$shortcutX.TargetPath = "C:\apps\application --switch"
$shortcutX.Save()
TL;DR:
工作。
$shortcutX.TargetPath = "C:\apps\application"
没用!
$shortcutX.TargetPath = "C:\apps\application --switch"
为什么?!?!?!?!
【问题讨论】:
标签: windows-7 powershell shortcut