我想使用如下批处理文件在带有图标的桌面上创建快捷方式:
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
但是它写了一个错误:
但是之间没有命令
"%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
有人能帮我吗?
&
在批处理文件/ Windows命令外壳程序中,“与”号()是一个特殊字符。它表示当前命令已结束,而新命令正在启动。
echo Const DESKTOP = &H10&>>"%TEMP%\testboost.vbs"
脚本实际上将其解释为:
echo Const DESKTOP =
H10
>>"%TEMP%\testboost.vbs"
这是不正确的,因为您只想打印一个&
字符。实际上,“语法错误”错误是关于试图H10
作为命令执行的脚本(不存在)。
要&
以字符串形式输出字符,您只需要使用批处理转义字符-克拉对其进行转义^
。
echo Const DESKTOP = ^&H10^&>>"%TEMP%\testboost.vbs"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句