@ECHO OFF :: This batch file configure a VirtualBox Virtual Machine. :: https://www.virtualbox.org/manual/UserManual.html#vboxmanage TITLE VirtualBox Virtual Machine SET Version=13.1.0 SET /p Version="Enter the Debian version (Press Enter to keep <%Version%>): " SET File=debian-%Version%-amd64-netinst.iso SET ISO=%USERPROFILE%\Downloads\%File% SET URL=https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/%File% IF NOT EXIST "%ISO%" ( ECHO "%ISO%" does not exist, attempting to download. bitsadmin /transfer DownloadDebian /download /priority FOREGROUND "%URL%" "%ISO%" IF NOT EXIST "%ISO%" ( SET /p Prompt="%ISO%" does not exist, failed to download. EXIT /b 1 ) ) SET Name=Debian %Version% SET /p Name="Enter Virtual Machine name (Press Enter to keep <%Name%>): " SET Folder=%USERPROFILE%\VirtualBox VMs\%Name% MKDIR "%Folder%" 2> NUL SET VDI=%Folder%\%Name%.vdi IF NOT EXIST VBoxManage ( PATH %PATH:)=^)%;%VBOX_MSI_INSTALL_PATH% ) ECHO Available Bridged Adapters: FOR /f "tokens=1*" %%a IN ('VBoxManage list bridgedifs ^| findstr "^Name:"') DO ( IF NOT DEFINED Adapter ( Set Adapter=%%b ) ECHO %%b ) SET /p Adapter="Enter Bridged Adapter name (Press Enter to keep <%Adapter%>): " VBoxManage createvm^ --name "%Name%"^ --ostype Debian_64^ --register^ VBoxManage modifyvm "%Name%"^ --audio-codec ad1980^ --audio-out on^ --boot1 dvd^ --boot2 disk^ --boot3 none^ --boot4 none^ --bridge-adapter1 "%Adapter%"^ --clipboard-mode bidirectional^ --cpus 4^ --drag-and-drop bidirectional^ --graphicscontroller vmsvga^ --memory 12288^ --mouse usbtablet^ --nic1 bridged^ --pae off^ --rtc-use-utc on^ --usb-ohci on^ --usb-ehci on^ --vram 128^ VBoxManage storagectl "%Name%"^ --add ide^ --name "IDE"^ VBoxManage storageattach "%Name%"^ --device 0^ --medium "%ISO%"^ --port 1^ --storagectl "IDE"^ --type dvddrive^ VBoxManage storagectl "%Name%"^ --add sata^ --name "SATA"^ --portcount 1^ VBoxManage createmedium^ --filename "%VDI%"^ --size 131072^ --variant Fixed^ VBoxManage storageattach "%Name%"^ --device 0^ --medium "%VDI%"^ --port 0^ --storagectl "SATA"^ --type hdd^ :: VBoxManage showvminfo "%Name%"^ VBoxManage snapshot "%Name%" take "Initial"^ --description="Initial pre install"^ VBoxManage startvm "%Name%"^