Created
July 30, 2020 07:33
-
-
Save michaelp85/05ece28e3a959ffda008441774170dac to your computer and use it in GitHub Desktop.
Check Unity License and License
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM License Unity | |
SET unitySerial[0]=X4-XXXX-XXXX-XXXX-XXXX-XXXX | |
SET unitySerial[1]=X4-XXXX-XXXX-XXXX-XXXX-XXXX | |
SET unityUsername=redacted@example.com | |
SET unityPassword=redacted | |
REM See https://stackoverflow.com/questions/5777400/how-to-use-random-in-batch-script/5777608#5777608 | |
REM This will return either 0 or 1, which we'll use below to set our variable to either unitySerial[0] or unitySerial[1] | |
set /a unitySerialNum=%random% %%2 | |
set unitySerialToUse=!unitySerial[%unitySerialNum%]! | |
REM Check If the Unity_lic.ulf file exists | |
IF EXIST "C:\ProgramData\Unity\Unity_lic.ulf" ( | |
findstr /MC:"StopDate Value=\"2020-12-24T00:00:00\"" C:\ProgramData\Unity\Unity_lic.ulf | |
if !errorlevel! == 0 ( | |
REM Running pro version, do nothing! | |
) else ( | |
REM Running outdated license, or personal edition, re-license it | |
del /s /q C:\ProgramData\Unity\Unity_lic.ulf >NUL 2>&1 | |
PING 127.0.0.1 -n 5 >NUL 2>&1 | |
"C:\Program Files\Unity 2019.3.6f1\Editor\Unity.exe" -quit -batchmode -serial %unitySerialToUse% -username %unityUsername% -password %unityPassword% | |
) | |
) ELSE ( | |
REM Attempt to License Unity | |
PING 127.0.0.1 -n 5 >NUL 2>&1 | |
"C:\Program Files\Unity 2019.3.6f1\Editor\Unity.exe" -quit -batchmode -serial %unitySerialToUse% -username %unityUsername% -password %unityPassword% | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment