Script for deploying the spark.properties file

Version 1

    I created a batch script for deploying the spark.properties file to all user profiles on a Windows machine.  When the batch file is executed, it checks if the spark.properties file exists and if it doesn't, it copies the file from C:\Program Files\Spark (you need to create your default spark.properties file there first) to the Spark folder in the user profile.  It will also create the Spark folder in the user profile if it doesn't exist.  Then it launches Spark.  If the file aleady exists in the user profile, it just launches Spark.  Here's the code.  Save it as a .bat file.

     

    REM ECHO OFF

    echo.

    :Check
    If exist "%USERPROFILE%\Spark\spark.properties" goto Launch
    If not errorlevel 1 goto Copy

    :Launch
    start "" "C:\Program Files\Spark\Spark.exe"
    exit

    :Copy
    mkdir "%USERPROFILE%\Spark\"
    copy "C:\Program Files\Spark\spark.properties" "%USERPROFILE%\Spark"
    goto Launch

     

    I am using this on a Terminal Services server, and will have the users execute the batch file instead of the .exe to open Spark.