powered by Jive Software

Install Spark Batch Script for Windows Users

Hello all,

Thanks to everyone, particularly the developers, for keeping this project alive!

I wanted to try and give back a little by providing the script I wrote up to install Spark 2.9.x.

Pre-requisites:

  • This install script must be in the same network share or folder as the .exe installer and the .exe installer must match line 25 in my script (right now it’s the default name of spark_2_9_0-with-jre.exe).
  • You must create a subfolder called AppData_Roaming_Spark in the folder with the InstallSpark.cmd file
  • I included the spark.properties file as designed without username= or password with the encrypted password in the file. This will automatically be inserted by the script from the previous spark.properties. If this is a fresh install, the Spark software will automatically add those lines once the user logs in.
  • I also included Spark_2_9_0.txt in the folder so the system knows that version is installed and not to overwrite it twice.
  • I included a security folder from my profile after adding my self-signed certificates. This way users won’t be prompted with the message about trusting the certificate.
  • I also removed reversi, tictactoe, and translator jar files (lines 38 to 47). You may also do this via the spark.properties file but I do this to be sure they aren’t available to the users. Feel free to remove these lines or comment them out.
  • I also copy some .wav files over but you can also comment these lines out. (lines 49 to 52)
  • Finally, if you want to make this installer quiet, just add a space after the .exe and -q to the end of line 25 (line 25 is: %~dp0spark_2_9_0-with-jre.exe) AND be sure to remove any “pause” lines (13, 26, 82).

InstallSpark.cmd:

@ECHO OFF
set "PFiles=C:\Program Files"
cls
echo ***************************
echo ***   SPARK INSTALLER   ***
echo ***    BY RYAN BLAKE    ***
echo ***************************
echo.
echo This will install Spark version 2.9.0 on your computer
echo.
echo Click run if prompted and install Spark
echo.
pause
echo Killing Spark if it is running...
taskkill /F /IM spark.exe
echo If you see an error above, it is safe to ignore...
echo ...just means Spark was not running.
echo.
echo During install, uncheck add to Quick Launch
echo.
echo Once Spark is completely installed...
echo ...do not select Run Spark at the end
echo.
echo Once finished...
%~dp0spark_2_9_0-with-jre.exe
pause
echo.
taskkill /F /IM spark_2_9_0-with-jre.exe
tskill spark_2_9_0-with-jre.exe
echo.
if exist "C:\Program Files (x86)\Spark" (
	set "PFiles=C:\Program Files (x86)"
	echo Looks like you are running Windows 64-bit
	echo ...making adjustments...
	echo.
)
echo.
cd /d %PFiles%\Spark\plugins
if exist "%PFiles%\Spark\plugins\reversi.jar" (
	del /F /Q reversi.jar
)
if exist "%PFiles%\Spark\plugins\tictactoe.jar" (
	del /F /Q tictactoe.jar
)
if exist "%PFiles%\Spark\plugins\translator.jar" (
	del /F /Q translator.jar
)
echo.
cd /d "%PFiles%\Spark\resources\sounds\"
if not exist "HostPhoneRing.wav" (
	xcopy /H "%~dp0WebexSounds\*"
)
echo.
echo Setting up all existing user profiles and migrating credentials
FOR /f "tokens=*" %%G in ('dir /b /a:d-s-l "%SystemDrive%\Users"') DO (
  IF /I NOT "%%G"=="Public" (
    IF NOT EXIST "%SystemDrive%\Users\%%G\AppData\Roaming\Spark" ( 
		md "%SystemDrive%\Users\%%G\AppData\Roaming\Spark"
	)
	IF EXIST "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties" (
		IF NOT EXIST "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties.old" (
			move "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties" "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties.old"
		)
	)
	IF NOT EXIST "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\Spark_2_9_0.txt" (
		xcopy.exe "%~dp0AppData_Roaming_Spark\*" "%SystemDrive%\Users\%%G\AppData\Roaming\Spark" /E /C /I /Q /H /R /K /Y
	
		IF EXIST "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties.old" (
			findstr username "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties.old" >> "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties"
			findstr password "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties.old" >> "%SystemDrive%\Users\%%G\AppData\Roaming\Spark\spark.properties"
		)
	)
  )
)
echo.
echo Installation Complete.
echo.
echo You may now load Spark
echo.
echo Thanks!
echo.
pause
2 Likes