标题: [系统相关] [已解决]win7下bat命令,在开始菜单的附件accessories下,建快捷方式,并可运行? [打印本页]
作者: ygqiang 时间: 2014-12-3 11:37 标题: [已解决]win7下bat命令,在开始菜单的附件accessories下,建快捷方式,并可运行?
本帖最后由 ygqiang 于 2014-12-3 11:54 编辑
[已解决]win7系统bat命令,在开始菜单的附件accessories下面,建立快捷方式,并且可以运行?
在下面这个位置建立快捷方式
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\accessories\
(win7系统下,开始菜单下面的附件/accessories路径)
win7系统下,下面这个bat命令,在「开始」菜单下面建立快捷方式,并且可以运行。
startmenu改成accessories,好像也没用。
有人说:“startmenu是特殊文件夹所以可以用specialfolders函数获取路径
accessories不是特殊文件,所以需要把specialfolders函数整个替换成确定的accessories文件夹路径”- ::创建exe文件的lnk快捷方式
- @echo off
- set "SrcFile=%SystemRoot%\system32\shutdown.exe"
- set "Args=-s -t 2"
- set "LnkFile=关机.LNK"
- call :CreateShort "%SrcFile%" "%Args%" "%LnkFile%"
- pause & goto :eof
-
- ::Arguments 目标程序参数
- ::Description 快捷方式备注
- ::FullName 返回快捷方式完整路径
- ::Hotkey 快捷方式快捷键
- ::IconLocation 快捷方式图标,不设则使用默认图标
- ::TargetPath 目标
- ::WindowStyle 窗口启动状态
- ::WorkingDirectory 起始位置
-
- :CreateShort
- mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""startmenu"") & ""\%~3""):b.TargetPath=""%~1"":b.WorkingDirectory=""%~dp1"":b.Arguments=""%~2"":b.Save:close")
复制代码
作者: ygqiang 时间: 2014-12-3 11:54
解决了。。。- ::创建exe文件的lnk快捷方式
- @echo off
- set "SrcFile=%SystemRoot%\system32\shutdown.exe"
- set "Args=-s -t 2"
- set "LnkFile=关机.LNK"
- call :CreateShort "%SrcFile%" "%Args%" "%LnkFile%"
- pause & goto :eof
-
- ::Arguments 目标程序参数
- ::Description 快捷方式备注
- ::FullName 返回快捷方式完整路径
- ::Hotkey 快捷方式快捷键
- ::IconLocation 快捷方式图标,不设则使用默认图标
- ::TargetPath 目标
- ::WindowStyle 窗口启动状态
- ::WorkingDirectory 起始位置
-
- :CreateShort
- mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""startmenu"") & ""\\Programs\accessories\%~3""):b.TargetPath=""%~1"":b.WorkingDirectory=""%~dp1"":b.Arguments=""%~2"":b.Save:close")
复制代码
作者: ygqiang 时间: 2014-12-3 12:26
本帖最后由 ygqiang 于 2014-12-3 12:32 编辑
- ——————————————————————————————————————————————————
- ——————————————————————————————————————————————————
- del /q 0000-win7.vbs
-
- ::创建exe文件的lnk快捷方式
- ::win7系统下,在开始菜单的附件accessories下面,建立快捷方式
- @echo off
- set "SrcFile=%SystemRoot%\system32\shutdown.exe"
- set "Args=-s -t 2"
- set "LnkFile=关机.LNK"
- call :CreateShort "%SrcFile%" "%Args%" "%LnkFile%"
- pause & goto :eof
-
- ::Arguments 目标程序参数
- ::Description 快捷方式备注
- ::FullName 返回快捷方式完整路径
- ::Hotkey 快捷方式快捷键
- ::IconLocation 快捷方式图标,不设则使用默认图标
- ::TargetPath 目标
- ::WindowStyle 窗口启动状态
- ::WorkingDirectory 起始位置
-
- :CreateShort
- mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""startmenu"") & ""\\Programs\accessories\%~3""):b.TargetPath=""%~1"":b.WorkingDirectory=""%~dp1"":b.Arguments=""%~2"":b.Save:close")
-
-
- ;创建exe文件的lnk快捷方式
- ::win7系统下,在开始菜单的附件accessories下面,建立快捷方式
- 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\System Tools\Resource Monitor.lnk"
-
- 0000-win7.vbs "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\关机.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"
-
- 0000-win7.vbs "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\accessories\注销.lnk"
-
- ping 127.0.0.1 -n 5 >nul 2>nul
-
- del /q 0000-win7.vbs
复制代码
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |