创建快捷方式,将参数添加到程序路径

Create a shortcut with parameters added to the program path

这是代码,如果我右键单击新的 .Lnk 并删除引号,它就会工作
来自 "C:\Windows\System32\control.exe /name Microsoft.Windowsupdate"
C:\Windows\System32\control.exe /name Microsoft.Windowsupdate

echo off
Cls
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%USERPROFILE%\Desktop\Weekly Maintenance\Windows Update.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "C:\Windows\System32\control.exe /name Microsoft.Windowsupdate" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
pause
cscript /nologo %SCRIPT%
del %SCRIPT%

有什么想法吗?

WshShortcut.TargetPath 上的文档说:

This property is for the shortcut's target path only.
Any arguments to the shortcut must be placed in the Argument's property.

工作代码片段:

echo oLink.TargetPath = "C:\Windows\System32\control.exe" >> %SCRIPT%
echo oLink.Arguments = "/name Microsoft.Windowsupdate" >> %SCRIPT%

以及整个固定代码:

@echo off
Cls
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%USERPROFILE%\Desktop\Weekly Maintenance\Windows Update.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "C:\Windows\System32\control.exe" >> %SCRIPT%
echo oLink.Arguments = "/name Microsoft.Windowsupdate" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
pause