Attach cloned VDI to new VM via commandline

This is for discussing general topics about how to use VirtualBox.
Locked
se000
Posts: 2
Joined: 11. Jan 2011, 07:18
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Windows XP

Attach cloned VDI to new VM via commandline

Post by se000 »

Hello, am starting to write batch file to clone VM but can't find the way to attach vdi to new VM via VBoxManage.exe
Can someone help me with that?

Code: Select all

@echo off
echo.           Enter the USB disk name where the  VirtualBox portable is:
set /p Disk=
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe createvm --name "WinXPnew" -register
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe modifyvm WinXPnew --memory 512
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe clonehd "%Disk%:\distr\Portable-VirtualBox\data\.VirtualBox\Machines\Windows XP\Windows XP.vdi" "%Disk%:\distr\Portable-VirtualBox\data\.VirtualBox\Machines\WinXPnew\WinXPnew.vdi" 
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe internalcommands sethduuid "%Disk%:\distr\Portable-VirtualBox\data\.VirtualBox\Machines\WinXPnew\WinXPnew.vdi" 
-----here must be line with attaching vdi to Virtual Machine ---------------

Code: Select all

echo. enter the new  VirtualBox name for cloned wm:
set /p vmname=
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe modifyvm WinXPnew --name %vmname% 
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe startvm %vmname%
pause
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Attach cloned VDI to new VM via commandline

Post by Perryg »

We do not support portable VirtualBox.
Locked