Files
revit-batch/RevitServerInstaller.bat

96 lines
2.7 KiB
Batchfile

@echo off
REM Version: 2.1
REM Revit server installer script. Sets up RSN.ini
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
REM --------
REM Settings
REM --------
REM Separate elements in these lists with spaces
SET SERVERPATHS=192.168.1.50
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 false, it's possible that the same address will be listed multiple times in RSN.ini
REM If you set this to true, you will loose all your current settings.
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 ---
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 Overwrite disabled, the script will append any new servers to the file.
)
echo ---
pause
echo ---
setlocal ENABLEDELAYEDEXPANSION
(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 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
REM -----------------------
REM End of the script
REM -----------------------