赞
踩
echo. 正在创建快捷方式...
set desktop=
:: 桌面路径
call :__CreateDesktopPath
:: 快捷方式一
call :__StringCat %desktop% "\汽车玻璃升降器耐久性测试系统.lnk"
set target=%result%
call :__StringCat %installPath% "\WindowLiftDurabilityTest.exe"
set srcFile=%result%
call :__StringCat %srcFile% ",0"
set icon=%result%
call :__CreateShort %srcFile% %target% %icon% %installPath%
echo. 安装完成, 按回车键结束... & pause > nul
goto __success
:: 判断语言环境
:__Locale
set SystemLocale=
ver|find /i "Version">nul
if %errorlevel% equ 0 (set SystemLocale=EN_US&goto:eof) else set SystemLocale=ZH_CN&goto:eof
:: 判断系统版本
:__Version
set SystemVersion=
ver|findstr "5\.[0-9]\.[0-9][0-9]*">nul&&(set SystemVersion=WIN_XP&goto:eof)
ver|findstr "6\.[0-9]\.[0-9][0-9]*">nul&&(set SystemVersion=WIN_VISTA_7&goto:eof)
:: 根据不同系统版本、不同语言环境生成“桌面”的绝对路径
:__CreateDesktopPath
set en_desktop="\DESKTOP"
set cn_desktop="\桌面"
call :__Locale
call :__Version
if %SystemLocale%==EN_US (call :__Compound %en_desktop%&goto:eof)
if %SystemVersion%==WIN_XP (
if %SystemLocale%==EN_US (
call :__Compound %en_desktop% & goto :eof
) else (
call :__Compound %cn_desktop% & goto :eof
)
) else (
call :__Compound %en_desktop% & goto :eof
)
:: 字符串合成
:__Compound
call :__StringCat "%USERPROFILE%" %1
set desktop=%result%
goto :eof
:: 字符串连接 会自动去掉最外层的双引号后连接
:__StringCat
set result=
set result=%~1%~2
set result="%result%"
goto :eof
:__CreateShort
set vbsStr="Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""%~2""):b.TargetPath=""%~1"":b.WorkingDirectory=""%~4"":b.IconLocation=""%~3"":b.Save:close"
mshta VBScript:Execute(%vbsStr%)
goto :eof
:__success
set installPath=
set result=
set SystemVersion=
set desktop=
set SystemLocale=
set en_desktop=
set cn_desktop=
set vbsStr=
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。