-
Notifications
You must be signed in to change notification settings - Fork 1
/
bulkexecute.bat
62 lines (56 loc) · 1.63 KB
/
bulkexecute.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@echo off
openfiles > nul 2>&1
if not %errorlevel% equ 0 (
echo You didn't run this batch file as Administrator! Please try again... Exiting in 5 seconds...
timeout 5 > nul
exit /b 1
)
set wtitle=Bulk Install
pushd %~dp0
REM cd %~dp0
set ext=*.exe *.msi
set postfolder=postexecute
set quietfolder=quietinstall
set /a count=0
set /a current=0
set /a progress=0
setlocal enabledelayedexpansion
for /r %%x in (%ext%) do set /a count+=1
title !progress!%% %wtitle% !current! of %count%
echo RECURSIVELY RUNNING FILES...
echo.
for /f "delims=" %%f in ('dir /s /b /a:-d %ext% ^| findstr /v /i /c:"\%quietfolder%\\" /c:"\%postfolder%\\"') do (
echo Starting: %%f
start /wait "wtitle" "%%f"
echo File %%~nf exited with error code %errorlevel%
echo.
set /a current+=1
set /a progress=100*current/count
title !progress!%% %wtitle% !current! of %count%
)
echo RECURSIVELY AND QUIETLY INSTALLING PACKAGES IN %quietfolder%
echo.
for /f "delims=" %%f in ('dir /s /b /a:-d %ext% ^| findstr /i /c:"\%quietfolder%\\"') do (
echo Installing: %%f
start /wait msiexec /i "%%f" /qn
echo File %%~nf exited with code %errorlevel%
echo.
set /a current+=1
set /a progress=100*current/count
title !progress!%% %wtitle% !current! of %count%
)
echo RUNNING POST INSTALL FILES IN %postfolder%...
echo.
for /f "delims=" %%f in ('dir /s /b /a:-d %ext% ^| findstr /i /c:"\%postfolder%\\"') do (
echo Installing: %%f
start /wait "wtitle" "%%f"
echo File %%~nf exited with code %errorlevel%
echo.
set /a current+=1
set /a progress=100*current/count
title !progress!%% %wtitle% !current! of %count%
)
endlocal
popd
echo Sequence complete, press any key to exit!
pause > nul