win7系统,运行1次bat命令,就自动将快捷方式,添加到开始菜单的这个位置?如何实现?
开始菜单—所有程序,里面的软件快捷键,鼠标点击右键项目,里面有“附到开始菜单”的选项。
但是也有的没有这个选项,这是啥原因?
每次重装win7系统或者更换1台win7主机,都需要用鼠标右键,重复点击很多软件的快捷键,才能全部添加到开始菜单这个位置。
如果bat批处理命令,运行1次就能实现,会更方便。- ——————————————————————————————————————————————————
- del /q 0000-win7.vbs
-
- ;创建exe文件的lnk快捷方式
- set SrcFile=logoff
- set LnkFile=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\accessories\注销
- call :CreateShort "%SrcFile%" "%LnkFile%"
- goto :eof
-
- ::Arguments 目标程序参数
- ::Description 快捷方式备注
- ::FullName 返回快捷方式完整路径
- ::Hotkey 快捷方式快捷键
- ::IconLocation 快捷方式图标,不设则使用默认图标
- ::TargetPath 目标
- ::WindowStyle 窗口启动状态
- ::WorkingDirectory 起始位置
-
- :CreateShort
- mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""%~2.lnk""):b.TargetPath=""%~1"":b.WorkingDirectory=""%~dp1"":b.Save:close")
-
-
-
- echo Sub startpin(lnkfile)>>0000-win7.vbs
- echo 'Const CSIDL_COMMON_PROGRAMS = ^&H17>>0000-win7.vbs
- echo Set objShell = CreateObject("Shell.Application")>>0000-win7.vbs
- echo 'Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)>>0000-win7.vbs
- echo 'strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path>>0000-win7.vbs
- echo path=Left(lnkfile,InStrRev(lnkfile,"\"))>>0000-win7.vbs
- echo Set objFolder = objShell.Namespace(path)>>0000-win7.vbs
- echo name=Replace(lnkfile,path,"")>>0000-win7.vbs
- echo Set objFolderItem = objFolder.ParseName(name)>>0000-win7.vbs
- echo Set colVerbs = objFolderItem.Verbs>>0000-win7.vbs
- echo For Each objVerb in colVerbs>>0000-win7.vbs
- echo If Left(objVerb.name,2) = "附到" Then objVerb.DoIt>>0000-win7.vbs
- echo Next>>0000-win7.vbs
- echo End Sub>>0000-win7.vbs
- echo startpin Wscript.Arguments(0)>>0000-win7.vbs
-
- ping 127.0.0.1 -n 3 >nul 2>nul
-
-
- 0000-win7.vbs "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk"
- 0000-win7.vbs "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Calculator.lnk"
- 0000-win7.vbs "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\accessories\注销.lnk"
-
- 0000-win7.vbs "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools\Resource Monitor.lnk"
-
- 0000-win7.vbs "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Snipping Tool.lnk"
-
- 0000-win7.vbs "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Notepad.lnk"
- 0000-win7.vbs "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Command Prompt.lnk"
-
-
- ping 127.0.0.1 -n 3 >nul 2>nul
-
- del /q 0000-win7.vbs
-
- ——————————————————————————————————————————————————
复制代码
|