Skip to content

Instantly share code, notes, and snippets.

@smaqeelkazmi
Forked from Iristyle/Start-Vagrant.bat
Created December 10, 2019 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smaqeelkazmi/89cfae8266c0eab33609357c31eed834 to your computer and use it in GitHub Desktop.
Save smaqeelkazmi/89cfae8266c0eab33609357c31eed834 to your computer and use it in GitHub Desktop.
Windows startup script to fire up a Vagrant VM safely on boot (using Run registry key for instance)
ECHO OFF
cd /d %~dp0
for /f "tokens=2* delims= " %%F IN ('vagrant status ^| find /I "default"') DO (SET "STATE=%%F%%G")
ECHO Close this window if it remains open, and http://localhost:8081 is responsive
IF "%STATE%" NEQ "saved" (
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