Bat 批处理创建bat快捷方程式

阅读更多
网上找了半天,搞java的人不是很懂VB.. *.bat的文件创建之后,无法运行,后来找半天才找到,这里记录一下

set R_PATH=%~dp0
echo ****************%R_PATH%
set IconLocationPath="%R_PATH%/apache-tomcat-6.0.20/bin/startup.bat" '快捷方式的图标样式设置'
echo Dim WshShell,Shortcut>>tmp.vbs
echo Dim path,fso>>tmp.vbs
echo pathFd="%R_PATH%/apache-tomcat-6.0.20/bin">>tmp.vbs '被创建快捷图标的目录'
echo path="%R_PATH%/apache-tomcat-6.0.20/bin/startup.bat">>tmp.vbs '被创建快捷图标的程序位置'
echo Set fso=CreateObject("Scripting.FileSystemObject")>>tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut("%userprofile%\Desktop\G5_startup.lnk")>>tmp.vbs '快捷图标的存放位置'

echo Shortcut.IconLocation=%IconLocationPath%>>tmp.vbs
echo Shortcut.TargetPath=path>>tmp.vbs
echo Shortcut.WorkingDirectory=pathFd>>tmp.vbs '注意设置来源目录,网上没有
echo Shortcut.Save>>tmp.vbs
"%SystemRoot%\System32\WScript.exe" tmp.vbs
@del /f /s /q tmp.vbs
rem exit
pause

你可能感兴趣的:(bat批处理)