本帖最后由 lantern 于 2014-5-23 01:29 编辑
想弄个bat处理Virtualbox安装包- @echo off
- REM 获取最新版本号
- 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
- REM 去除行首空格
- 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 /f "tokens=4" %%i in ('dir VirtualBox\*.msi') do (echo %%i>>a.txt | findstr "msi" a.txt>b.txt)
- for /f "tokens=*" %%i in (b.txt) do (set msi=%%i)
- msiexec /a VirtualBox\%msi% /qb TARGETDIR="%CD%\VirtualBox\x86"
- msiexec /a VirtualBox\%msi% /qb TARGETDIR="%CD%\VirtualBox\x64"
- del *.txt *.html
- pause
复制代码 VirtualBox-4.3.12-93733-Win.exe解压到VirtualBox目录后有3个文件:
common.cab
VirtualBox-4.3.12-r93733-MultiArch_amd64.msi
VirtualBox-4.3.12-r93733-MultiArch_x86.msi
最后一步不会弄了,msiexec两行都是解压x86的msi...
怎么才能分别执行x86和x64?谢谢 |