创建桌面快捷方式及锁定到任务栏

# bat脚本


@echo off


set destPath=%HOMEDRIVE%\Users\%username%\AppData\Roaming\jzyx\jzmy
if not exist %destPath% md %destPath%
xcopy **.ico %destPath%\ /s /e /Y
::del /f /q **.ico
echo set WshShell = WScript.CreateObject("WScript.Shell")>tmp.vbs
echo strDesktop = WshShell.SpecialFolders("Desktop")>>tmp.vbs
echo set oShellLink = WshShell.CreateShortcut(strDesktop ^& "\**.lnk")>>tmp.vbs
echo oShellLink.TargetPath =url >>tmp.vbs
echo oShellLink.WindowStyle ="1">>tmp.vbs
echo oShellLink.Hotkey = "CTRL+SHIFT+Q">>tmp.vbs
:: 设置快捷方式的icon
echo oShellLink.IconLocation = "%destPath%\**.ico">>tmp.vbs
echo oShellLink.Description = "****">>tmp.vbs
echo oShellLink.WorkingDirectory = strDesktop>>tmp.vbs
echo oShellLink.Save>>tmp.vbs
:: 回到桌面
echo Set shell = CreateObject("Shell.Application")>>tmp.vbs
echo shell.ToggleDesktop>>tmp.vbs
call tmp.vbs
:: 任务栏锁定
call tmp2.vbs
:: 删除脚本
del /f /q tmp.vbs
del /f /q tmp2.vbs
:: 删除bat本身
del %0

pause



#创建任务栏锁定的脚本

Const CSIDL_COMMON_PROGRAMS = &H17 
Const CSIDL_PROGRAMS = &H2 
Const CSIDL_COMMON_DESKTOPDIRECTORY = &H0
set WshShell = WScript.CreateObject("WScript.Shell")
Set objShell = CreateObject("Shell.Application") 
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_DESKTOPDIRECTORY) 
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path 
strDesktop = WshShell.SpecialFolders("Desktop")
Msgbox strAllUsersProgramsPath
Msgbox strDesktop


Set objFolderItem = objAllUsersProgramsFolder.ParseName("***.lnk") 
Set colVerbs = objFolderItem.Verbs 


For Each objVerb in colVerbs 
    
    If Replace(objVerb.name, "&", "") = "锁定到任务栏(K)" Then objVerb.DoIt
Next




展开阅读全文

没有更多推荐了,返回首页