分享

BAT 批处理创建桌面快捷方式代码大全

 悟静 2013-06-07
【一】 直接生成:
echo [InternetShortcut]>>"%USERPROFILE%\桌面\BatMPlayer.url"
echo URL="C:\BatMPlayer\BatMPlayer.bat">>"%USERPROFILE%\桌面\BatMPlayer.url"
echo IconIndex=99>>"%USERPROFILE%\桌面\BatMPlayer.url"
echo IconFile=%SystemRoot%\system32\SHELL32.dll>>"%USERPROFILE%\桌面\BatMPlayer.url"
 
【二】 先设置变量生成:
 @echo off
set "path=C:\BatMPlayer\BatMPlayer.bat"
set "name=我的BatMPlayer"
set m="%USERPROFILE%\桌面\%name%.url"
echo [InternetShortcut] >>%m%
echo URL="%path%" >>%m%
echo IconIndex=10 >>%m%
echo IconFile=C:\windows\system32\shell32.dll >>%m%
pause
 
 
【三】 简单生成:
 @echo off
md "%userprofile%\桌面\1"
(echo [.shellclassinfo]
echo iconfile="%%systemroot%%\system32\shell32.dll"
echo iconindex=-50
)>"%userprofile%\桌面\1\desktop.ini"
attrib +S +R "%userprofile%\桌面\1"
pause
 
代码解释:
 [InternetShortcut]         ;快捷方式。
URL="C:\BatMPlayer\BatMPlayer.bat"          ;快捷方式的程序路径。
IconIndex=99         ;快捷方式使用的图标的顺序号(此处为系统文件中的图标的顺序,位于以下的IconFile文件夹中,具体查看第三部分的《Shell32.Dll 图标资源对照表》)。
IconFile=%SystemRoot%\system32\SHELL32.dll         ;快捷方式图标的位置(此处为系统文件路径,常见系统快捷方式的图标存放位置)。
"%USERPROFILE%\桌面\BatMPlayer.url"        ; 快捷方式创建位置(此处为桌面),注意双引号和后缀名

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多