Last active
February 1, 2016 17:59
-
-
Save rbarros/9cf011364c8379e628ef to your computer and use it in GitHub Desktop.
Vagrant VM start bat
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 | |
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