From 700383fb7e27d6e3146821c3740a845f1a8345ee Mon Sep 17 00:00:00 2001 From: infeeeee Date: Fri, 8 Feb 2019 19:11:02 +0100 Subject: [PATCH] Complete rewrite of the revitserverinstaller --- exobim-revitServerInstaller.bat | 137 ++++++++++++++++++-------------- 1 file changed, 77 insertions(+), 60 deletions(-) diff --git a/exobim-revitServerInstaller.bat b/exobim-revitServerInstaller.bat index dcebeb6..9cc843f 100644 --- a/exobim-revitServerInstaller.bat +++ b/exobim-revitServerInstaller.bat @@ -1,77 +1,94 @@ @echo off -REM Version: 1.1 +REM Version: 2.0 REM Revit server installer script for exobim -REM Usage: run this after download. it's possible that you have to run it as admin. +REM Usage: run this after download. It's possible that you have to run it as admin. +REM (Re)start revit after running this script REM Created by Peter Gyetvai: gyetpet@gmail.com with the help of the internet -SET SERVERPATH=exobim.asuscomm.com +REM -------- +REM Settings +REM -------- -SET FOLDER2017=%programdata%\Autodesk\Revit Server 2017 -SET FOLDER2018=%programdata%\Autodesk\Revit Server 2018 -SET FOLDER2019=%programdata%\Autodesk\Revit Server 2019 -SET INI2017=%FOLDER2017%\Config\RSN.ini -SET INI2018=%FOLDER2018%\Config\RSN.ini -SET INI2019=%FOLDER2019%\Config\RSN.ini +REM Separate elements in these lists with spaces +SET SERVERPATHS=exobim.asuscomm.com +SET REVITVERSIONS=2017 2018 2019 + +REM Set this if you want to overwrite the existing RSN.ini paths. +REM Note this script doesn't check for duplicates. If you set this to true, it's possible that the same address will be listed in RSN.ini +SET OVERWRITE=true + +REM ----------------------- +REM Beginning of the script +REM ----------------------- + +echo --- +echo revitServerInstaller.bat +echo Created by Peter Gyetvai: gyetpet@gmail.com +echo --- +echo This script will add the paths of the servers to your local RSN.ini file. +echo Edit this script with notepad to set up the paths of the Revit servers. echo You have to restart Revit after running this script, or modifying your RSN.ini file -echo This script will add the following path to your RSN.ini: -echo %SERVERPATH% echo --- - -if exist "%FOLDER2017%" ( - echo Revit 2017 installed - if exist "%INI2017%" ( - echo RSN.ini exists, skipping - echo Modify your RSN.ini here: - echo "%INI2017%" - SET OK2017=no - ) else ( - echo Creating RSN.ini - echo %SERVERPATH% > "%INI2017%" - SET OK2017=ok - ) +echo Current settings: +echo Revit Server path(s): +echo %SERVERPATHS% +echo Revit version(s): +echo %REVITVERSIONS% +if "%OVERWRITE%" == "true" ( + echo Overwrite enabled, the script will delete existing settings! ) else ( - echo Revit 2017 not installed, skipping + echo Overwrite disabled, the script will append any new servers to the file. ) echo --- +pause +echo --- +setlocal ENABLEDELAYEDEXPANSION -if exist "%FOLDER2018%" ( - echo Revit 2018 installed - if exist "%INI2018%" ( - echo RSN.ini exists, skipping - echo Modify your RSN.ini here: - echo "%INI2018%" - SET OK2018=no +(for %%a in (%REVITVERSIONS%) do ( + SET VERSION=%%a + SET FOLDER=%programdata%\Autodesk\Revit Server !VERSION! + SET INI=!FOLDER!\Config\RSN.ini + + echo Installing for Revit !VERSION! + + if exist "!FOLDER!" ( + echo Revit !VERSION! installed, Revit Server folder found + + REM check if RSN.ini exists + if exist "!INI!" ( + echo Existing RSN.ini found + if "%OVERWRITE%" == "true" ( + echo Overwrite enabled, creating new empty RSN.ini + copy /y NUL "!INI!" >NUL + ) ) else ( - echo Creating RSN.ini - echo %SERVERPATH% > "%INI2018%" - SET OK2018=ok - ) -) else ( - echo Revit 2018 not installed, skipping + echo Creating new RSN.ini + copy /y NUL "!INI!" >NUL + ) + + echo Adding new server addresses to RSN.ini + for %%b in (%SERVERPATHS%) do ( + echo %%b >> !INI! + ) + + echo Installed for Revit !VERSION! + SET SUCCESSVERSION=!SUCCESSVERSION! !VERSION! + + ) else ( + echo Revit !VERSION! not installed, skipping + ) + echo --- +)) + +echo Script finished +for %%c in (%SUCCESSVERSION%) do ( + echo Successfully set up Revit %%c ) echo --- +pause -if exist "%FOLDER2019%" ( - echo Revit 2019 installed - if exist "%INI2019%" ( - echo RSN.ini exists, skipping - echo Modify your RSN.ini here: - echo "%INI2019%" - SET OK2019=no - ) else ( - echo Creating RSN.ini - echo %SERVERPATH% > "%INI2019%" - SET OK2019=pl - ) -) else ( - echo Revit 2019 not installed, skipping -) -echo --- -if %OK2017% EQU ok echo Successfully set up Revit 2017 -if %OK2018% EQU ok echo Successfully set up Revit 2018 -if %OK2019% EQU ok echo Successfully set up Revit 2019 -echo --- - -pause \ No newline at end of file +REM ----------------------- +REM End of the script +REM ----------------------- \ No newline at end of file