I'm trying to create a script that runs multiple setup .exes silently and for whatever reason, when I finish executing the installation of 7zip silently in my batch file, no other commands execute after it.
Kinda at my wits end. I've tried pauses, echos, other subroutine that just echos (which works and executes commands after returning).
But for whatever reason, after I execute 7zip.exe /S it just quits executing commands even after returning from the subroutine I made to install it.
@echo OFF
SET 7ZipName=7z*.exe
SET x86SetupFilePath=C:\PSDARS-Setup\x86\
SET x64SetupFilePath=C:\PSDARS-Setup\x64\
SET x647ZipPath=C:\Program Files\7-Zip\
SET x867ZipPath=C:\Program Files (x86)\7-Zip\
:: 1. Check for OS architecture
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
if %OS%==32BIT GOTO :32BIT
if %OS%==64BIT GOTO :64BIT
:32BIT
:: Check arguments 1 = Installation Directory Path. If not set use base above
IF NOT %1.==. SET x86SetupFilePath=%~1
::Install 7zip
CALL :Install7Zip
setx PATH "%PATH%;%x647ZipPath%" /m
GOTO :ProgramEnd
:64BIT
:: Check arguments 1 = Installation Directory Path
IF NOT %1.==. SET x64SetupFilePath=%~1
::Install 7zip
CALL :Install7Zip
CALL :Test
Echo 7zip Installation Complete
::setx PATH "%PATH%;%x647ZipPath%" /m
GOTO :ProgramEnd
:Test
Echo a
GOTO :EOF
:: Author: Jacob Howarth
:: Date: 07/20/18
:: Description: This procedure will install the correct version of
:: the 7zip installer silent based on the architecture of the OS
::
:Install7Zip
IF %OS%==32BIT cd "%x86SetupFilePath%"
IF %OS%==64BIT cd "%x64SetupFilePath%"
for %%f in (%7ZipName%) do SET File=%~f
%File% /S
ECHO.%ERRORLEVEL%
GOTO :EOF
:: End of Install7Zip
echo 7zip Installation Complete
:ErrorInstall7Zip
echo Error installing 7zip for %OS% OS. x64 path = %x64SetupFilePath%, x86 path =%x86SetupFilePath%.
:ProgramEnd