- @echo off
- setlocal enableDelayedExpansion
- REM 获取最新版本号setlocal enableDelayedExpansion
- wget -N http://download.virtualbox.org/virtualbox/LATEST.TXT
- for /f %%i in (LATEST.TXT) do (set latest=%%i)
- REM 获取最新版本号目录
- echo http://download.virtualbox.org/virtualbox/%latest% >dl.txt
- REM .vbox-extpack也可直接下载了
- echo http://download.virtualbox.org/virtualbox/%latest%/Oracle_VM_VirtualBox_Extension_Pack-%latest%.vbox-extpack >>dl.txt
- wget -N -i dl.txt
- REM .exe包含小版本号,不能直接下载
- REM 获取exe文件名
- for /f "delims=<,> tokens=3 skip=4" %%i in (index.html) do (echo %%i>>ddd.txt)
- findstr "exe" ddd.txt>dddd.txt
- for /f %%i in (dddd.txt) do (set exe=%%i)
- REM 下载exe
- echo http://download.virtualbox.org/virtualbox/%latest%/%exe% >dl.txt
- wget -N -i dl.txt
- REM 解压VirtualBox-Version-Win.exe
- %exe% --extract --path VirtualBox --silent
- REM 解压Oracle_VM_VirtualBox_Extension_Pack-Version.vbox-extpack
- 7z x *.vbox-extpack -oVirtualBox
- 7z x VirtualBox\Oracle_VM_VirtualBox_Extension_Pack-* -oVirtualBox\ExtensionPacks
- for %%i in (64 86) do (
- for %%j in (VirtualBox\*%%i.msi) do (
- msiexec /a %%j /qb TARGETDIR="%CD%\VirtualBox\x%%i"
- )
- )
- del *.txt *.html
- pause
复制代码
|