Last active
December 7, 2018 09:21
-
-
Save baflo/91b086d677300194da00f6e6203e2202 to your computer and use it in GitHub Desktop.
Set port forwarding for running vbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
setlocal EnableExtensions | |
if "%~2"=="add" ( | |
if "%~1"=="" goto :usage | |
if "%~3"=="" goto :usage | |
"%programfiles%\Oracle\VirtualBox\VBoxManage.exe" controlvm "%~1" natpf1 "%~3" | |
goto :EOF | |
) | |
if "%~2"=="rm" ( | |
if "%~1"=="" goto :usage | |
if "%~3"=="" goto :usage | |
"%programfiles%\Oracle\VirtualBox\VBoxManage.exe" controlvm "%~1" natpf1 delete "%~3" | |
goto :EOF | |
) | |
:usage | |
echo Usage: | |
echo vboxvm-natpf ^<vmname^> ^(rm ^<pfname^> ^| add "<pfdef>" ^) | |
echo. | |
echo Format of ^<pfdef^> ^(all commas must appear^): | |
echo "[<rulename>],tcp|udp,[<hostip>],<hostport>,[<guestip>],<guestport>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment