Skip to content

Instantly share code, notes, and snippets.

@rbarros
Last active February 1, 2016 17:59
Show Gist options
  • Save rbarros/9cf011364c8379e628ef to your computer and use it in GitHub Desktop.
Save rbarros/9cf011364c8379e628ef to your computer and use it in GitHub Desktop.
Vagrant VM start bat
@echo off
CD /d \path\dir\vagrant
FOR /f "tokens=2 delims= " %%a in ('vagrant status ^| find /i "default"') do (
SET STATE=%%a
)
IF %STATE% equ "running" (
@echo Vagrant VM is running...
) ELSE (
IF %STATE% equ "saved" (
@echo Starting Vagrant VM from powered down state...
vagrant up
) ELSE (
IF %STATE% equ "poweroff" (
@echo Starting Vagrant VM from powered down state...
vagrant up
) else (
@echo Resuming Vagrant VM from saved state...
vagrant resume
)
)
)
IF errorlevel 1 (
@echo FAILURE! Vagrant VM unresponsive...
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment