@echo on

if EXIST "tmp.vbs" (
	del tmp.vbs /s /q
)

echo 从注册表里查找桌面地址
for /f "tokens=2,*" %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop"') do (
set desk=%%j
)

set fileName="%CD%\KEmulator.exe"
set shortCutName="%desk%\QQ降龙.lnk"
set IconPath="%CD%\icon.ico"
set ShortCutArgument="-jar ""%CD%\LZXL_Normal_Nokia_5800.jar"""
set WorkingDirectory="%CD%"

if EXIST %shortCutName% (
	del %shortCutName% /s /q
) 

echo 初始化
echo Dim WshShell,Shorcut >>tmp.vbs
echo Dim path,fso >>tmp.vbs

echo 调用方法地址
echo path=%fileName% >>tmp.vbs

echo 初始化工具对象
echo Set fso=CreateObject("Scripting.FileSystemObject") >>tmp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell") >>tmp.vbs

echo 创建快捷对象
echo strDesktop=WshShell.SpecialFolders("Desktop") >>tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut(%shortCutName%) >>tmp.vbs
echo Shortcut.TargetPath=path >>tmp.vbs
echo Shortcut.Arguments=%ShortCutArgument% >>tmp.vbs
echo Shortcut.WorkingDirectory=%WorkingDirectory% >>tmp.vbs
echo Shortcut.IconLocation=%IconPath% >>tmp.vbs

echo Shortcut.Save >>tmp.vbs

"%SystemRoot%\System32\WScript.exe" tmp.vbs

del tmp.vbs /s /q

echo 运行游戏
pushd %CD%
KEmulator.exe -jar "%CD%\LZXL_Normal_Nokia_5800.jar"
popd
