Skip to content

Instantly share code, notes, and snippets.

@raphox
Created April 29, 2014 11:35
Show Gist options
  • Save raphox/11397615 to your computer and use it in GitHub Desktop.
Save raphox/11397615 to your computer and use it in GitHub Desktop.
Vagrant bat to up/halt/suspend for Windows
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
:: Se você tiver mais de um projeto com Vagrant
SET WORKSPACES=(^
"D:\Proteste\vagrant\"^
"D:\Raphael\vagrant\"^
)
IF "%1" == "" (
:: Informe qual operação será realizada pelo Vagrant
SET /p vagrantCmd=What do you want [Up/halt/suspend]?:
IF "!vagrantCmd!" == "" SET vagrantCmd=up
) ELSE (
SET vagrantCmd=%%1
)
for %%s in %WORKSPACES% do (
ECHO.
ECHO The current workspace is %%s
IF "%1" == "" (
:: Confirme se realmente deseja executar a ação para seu respectivo projeto
SET /p vagrantProcess=Do you want execute "vagrant %vagrantCmd%" [Y/n]?:
) ELSE (
SET vagrantProcess=y
)
set TRUE=
IF "!vagrantProcess!" == "" set TRUE=1
IF "!vagrantProcess!" == "Y" set TRUE=1
IF "!vagrantProcess!" == "y" set TRUE=1
IF defined TRUE (
cd /d %%s
call vagrant %vagrantCmd%
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment