Skip to content

Commit 9884743

Browse files
authored
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
1 parent dfe161f commit 9884743

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

windows_install.bat

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
1-
@echo off
2-
title Setting up your machine for Selenium Testing!
1+
@echo off
2+
title Setting up your machine for Selenium Testing!
3+
call :isAdmin
34

4-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
5+
if %errorlevel% == 0 (
6+
goto :run
7+
) else (
8+
echo Requesting administrative privileges...
9+
goto :UACPrompt
10+
)
11+
12+
exit /b
13+
14+
:isAdmin
15+
fsutil dirty query %systemdrive% >nul
16+
exit /b
17+
18+
:run
19+
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
520

621
choco install firefox -y
722
choco install googlechrome -y
823
choco install phantomjs -y
924
choco install selenium-all-drivers -y
1025
choco install jdk8 -y
1126
choco install maven -y
12-
SETX PATH "%PATH%;C:\tools\selenium"
27+
SETX PATH "%PATH%;%ChocolateyToolsLocation%"
28+
29+
exit /b
30+
31+
:UACPrompt
32+
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
33+
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %~1", "", "runas", 1 >> "%temp%\getadmin.vbs"
34+
35+
"%temp%\getadmin.vbs"
36+
del "%temp%\getadmin.vbs"
37+
exit /B`
38+

0 commit comments

Comments
 (0)