From 9884743b7c2d98c87fb1ac7c1939304fe2f0dd0a Mon Sep 17 00:00:00 2001 From: Andrew Krug Date: Mon, 21 Jan 2019 11:30:37 -0500 Subject: [PATCH] Update windows_install.bat (#22) * Update windows_install.bat setting the get tools location for chocolately within path * Update windows_install.bat adding in elevating to admin so that the gettools env is set system wide thus usable --- windows_install.bat | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/windows_install.bat b/windows_install.bat index 046f7ea..80ac762 100644 --- a/windows_install.bat +++ b/windows_install.bat @@ -1,7 +1,22 @@ -@echo off -title Setting up your machine for Selenium Testing! + @echo off + title Setting up your machine for Selenium Testing! + call :isAdmin -@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" + if %errorlevel% == 0 ( + goto :run + ) else ( + echo Requesting administrative privileges... + goto :UACPrompt + ) + + exit /b + + :isAdmin + fsutil dirty query %systemdrive% >nul + exit /b + + :run + @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" choco install firefox -y choco install googlechrome -y @@ -9,4 +24,15 @@ choco install phantomjs -y choco install selenium-all-drivers -y choco install jdk8 -y choco install maven -y -SETX PATH "%PATH%;C:\tools\selenium" \ No newline at end of file +SETX PATH "%PATH%;%ChocolateyToolsLocation%" + + exit /b + + :UACPrompt + echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" + echo UAC.ShellExecute "cmd.exe", "/c %~s0 %~1", "", "runas", 1 >> "%temp%\getadmin.vbs" + + "%temp%\getadmin.vbs" + del "%temp%\getadmin.vbs" + exit /B` +