Skip to content

Instantly share code, notes, and snippets.

@jms1989
Created May 27, 2019 00:13
Show Gist options
  • Save jms1989/afde7918e09f3da550efe2dba7b7e841 to your computer and use it in GitHub Desktop.
Save jms1989/afde7918e09f3da550efe2dba7b7e841 to your computer and use it in GitHub Desktop.
resizing vmdk image
@echo off
if exist "C:\Program Files\Oracle\VirtualBox" set path="%path%;C:\Program Files\Oracle\VirtualBox"
set file=%1
set /A size=%2
echo Converting VMDK to VDI
VBoxManage clonemedium "%file%.vmdk" "%file%.vdi" --format vdi
echo Resizing Image
VBoxManage modifymedium "%file%.vdi" --resize %size%
if exist "%file%_resized.vmdk" (
echo Resized disk exists
) else (
echo Converting VDI image to VMDK
VBoxManage clonemedium "%file%.vdi" "%file%_resized.vmdk" --format vmdk --variant fixed
)
echo Deleting VDI image
VBoxManage closemedium disk "%file%.vdi" --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment