-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplex_launcher.bat
More file actions
64 lines (55 loc) · 2.05 KB
/
Copy pathplex_launcher.bat
File metadata and controls
64 lines (55 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@echo off
chcp 65001 >nul
cls
echo ================================================
echo Plex USB Launcher
echo ================================================
:: Determine USB drive
echo [INFO] Detecting USB drive...
set USB_DRIVE=%~d0
echo [OK] USB drive detected: %USB_DRIVE%
set PLEX_REGISTRY_PATH=%USB_DRIVE%\Plex\PlexData\plex_registry_backup.reg
:: Check for registry backup on USB
echo [INFO] Checking for registry backup on USB...
if exist "%PLEX_REGISTRY_PATH%" (
echo [OK] Backup found! Restoring registry values from USB backup...
reg import "%PLEX_REGISTRY_PATH%"
echo [OK] Registry successfully restored from USB backup.
) else (
echo [WARNING] No backup found on USB. Checking local registry...
reg query "HKEY_CURRENT_USER\Software\Plex, Inc." >nul 2>&1
if %errorlevel% == 0 (
echo [OK] Local registry found! Creating a new backup on USB...
reg export "HKEY_CURRENT_USER\Software\Plex, Inc." "%PLEX_REGISTRY_PATH%" /y
echo [OK] Backup saved to USB.
) else (
echo [ERROR] Neither a USB backup nor a local registry entry was found!
echo [INFO] No registry data available for backup or restore.
)
)
:: Überprüfe und erstelle Symlink für Plex AppData falls nicht vorhanden
set USERPROFILE_PATH=%USERPROFILE%\AppData\Local\Plex Media Server
if not exist "%USERPROFILE_PATH%" (
echo [INFO] Creating symlink for Plex Media Server data...
mklink /D "%USERPROFILE_PATH%" "%USB_DRIVE%\Plex\PlexData"
echo [OK] Symlink created.
) else (
echo [OK] Symlink already exists.
)
:: Start Plex
echo [INFO] Starting Plex...
start "" "%USB_DRIVE%\Plex\Plex Media Server\Plex Media Server.exe" --data-dir="%USB_DRIVE%\Plex\PlexData"
:: Wait for Plex to start
timeout /t 2 >nul
:: Check if Plex started successfully
echo [INFO] Verifying if Plex started successfully...
tasklist | find "Plex Media Server.exe" >nul
if %errorlevel% neq 0 (
echo [ERROR] Plex failed to start!
pause
exit /b 1
) else (
echo [OK] Plex started successfully!
)
echo [INFO] Script finished.
pause