Created
February 18, 2015 07:16
-
-
Save CumpsD/0c7015e1419f261e43d0 to your computer and use it in GitHub Desktop.
Corporate Configurator
This file contains hidden or 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 | |
SET CORPORATENAME=Enterprisey | |
SET CORPORATEPROXY=http://proxy.corporate.com:80 | |
SET CORPORATEPAC=http://corporate/corporate.pac | |
SET NL=0 | |
IF "%1"=="setup" ( | |
SET INSTALLOP=1 | |
SET NL=1 | |
GOTO ProcessChoice ) | |
IF "%1"=="restore" ( | |
SET INSTALLOP=2 | |
SET NL=1 | |
GOTO ProcessChoice ) | |
:AvailableOptions | |
ECHO Welcome to the wifi configurator | |
ECHO ================================ | |
ECHO Things you can do with this configurator: | |
ECHO [1] Setup environment for the %CORPORATENAME% Wifi | |
ECHO [2] Restore environment | |
ECHO [X] Exit | |
ECHO. | |
SET INSTALLOP=X | |
SET /P INSTALLOP="Select an option [X]: " | |
:ProcessChoice | |
REM ECHO %INSTALLOP% | |
IF "%INSTALLOP%"=="1" ( GOTO SetupCorporate ) | |
IF "%INSTALLOP%"=="2" ( GOTO RestoreSettings ) | |
IF /I "%INSTALLOP%"=="X" ( GOTO TheEnd ) | |
IF "%INSTALLOP%"=="" ( GOTO TheEnd ) | |
IF NOT "%INSTALLOP%"=="1" ( | |
IF NOT "%INSTALLOP%"=="2" ( | |
ECHO Invalid option! | |
ECHO. | |
GOTO AvailableOptions | |
)) | |
REM --------------------------------------------------------------------------- | |
:SetupCorporate | |
IF "%NL%"=="0" ( ECHO. ) | |
ECHO Setting up environment for %CORPORATENAME%. | |
ECHO - Setup .npmrc | |
CALL npm config set proxy %CORPORATEPROXY% | |
CALL npm config set https-proxy %CORPORATEPROXY% | |
ECHO - Setup .gitconfig | |
CALL git config --global hub.protocol https | |
CALL git config --global url."https://".insteadOf git:// | |
CALL git config --global http.proxy %CORPORATEPROXY% | |
ECHO - Setup .pac file | |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "%CORPORATEPAC%" /f | |
ECHO Environment configured for %CORPORATENAME%. | |
GOTO TheEnd | |
REM --------------------------------------------------------------------------- | |
REM --------------------------------------------------------------------------- | |
:RestoreSettings | |
IF "%NL%"=="0" ( ECHO. ) | |
ECHO Restoring environment... | |
ECHO - Setup .npmrc | |
CALL npm config delete proxy | |
CALL npm config delete https-proxy | |
ECHO - Setup .gitconfig | |
REM CALL git config --global --unset hub.protocol | |
REM CALL git config --global --unset url."https://".insteadOf | |
REM CALL git config --global --unset http.proxy | |
CALL git config --global --remove-section hub | |
CALL git config --global --remove-section url."https://" | |
CALL git config --global --remove-section http | |
ECHO - Setup .pac file | |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "" /f | |
ECHO Environment restored. | |
GOTO TheEnd | |
REM --------------------------------------------------------------------------- | |
:TheEnd | |
REM PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment