【发布时间】:2015-11-13 18:07:15
【问题描述】:
我想使用这样的批处理文件在桌面上创建带有图标的快捷方式:
set SCRIPT="%TEMP%\theiboosts1.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%USERPROFILE%\Desktop\Internetovy Booster.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "c:\Booster\booster.bat" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
"%windir%\system32\timeout.exe" /t 5
start wscript.exe "%SCRIPT%"
"%windir%\system32\timeout.exe" /t 10
echo Const DESKTOP = &H10&>>"%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
echo Set objShell = CreateObject("Shell.Application") >>"%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
echo Set objFolder = objShell.NameSpace(DESKTOP) >>"%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
echo Set objFolderItem = objFolder.ParseName("Internetovy Booster.lnk") >>"%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
echo Set objShortcut = objFolderItem.GetLink >>"%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
echo objShortcut.SetIconLocation "C:\Windows\System32\SHELL32.dll",-16752 >>"%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
echo objShortcut.Save >>"%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
start wscript.exe "%TEMP%\testboost.vbs"
"%windir%\system32\timeout.exe" /t 5
但它写了一个错误:
Syntex of the command is incorrect
但是中间没有命令
"%windir%\system32\timeout.exe" /t 10
和
echo Const DESKTOP = &H10&>>"%TEMP%\testboost.vbs"
当我创建 .vbs 文件时,它工作正常
Const DESKTOP = &H10&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(DESKTOP)
Set objFolderItem = objFolder.ParseName("Internetovy Booster.lnk")
Set objShortcut = objFolderItem.GetLink
objShortcut.SetIconLocation "C:\Windows\System32\SHELL32.dll",-16752
objShortcut.Save
有人可以帮我吗?
【问题讨论】:
标签: batch-file vbscript icons shortcut