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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | @echo off setlocal enabledelayedexpansion :start set LOL_PATH="" if exist "%APPDATA%\LoG_lolinstallpath.txt" ( set /p LOL_PATH0=< "%APPDATA%\LoG_lolinstallpath.txt" call :Trim LOL_PATH !LOL_PATH0! echo Manually set Path found: "!LOL_PATH!" IF EXIST "!LOL_PATH!" ( goto runSpectate ) ) for /F "delims=" %%R in (' tasklist /FI "ImageName eq LeagueClient.exe" /FI "Status eq Running" /FO CSV /NH ') do ( set "FLAG1=" & set "FLAG2=" for %%C in (%%R) do ( if defined FLAG1 ( if not defined FLAG2 ( set LOL_PID=%%~C IF NOT "%LOL_PID%"=="" goto pidFound ) set "FLAG2=#" ) set "FLAG1=#" ) ) FOR %%G IN ("HKLM\SOFTWARE\WOW6432Node\Riot Games, Inc\League of Legends") DO ( for /f "usebackq skip=2 tokens=1,2*" %%a in (`%systemroot%\system32\REG.EXE QUERY %%G /v "Location"`) do ( set LOL_PATH=%%c echo "Path found: !LOL_PATH! goto runSpectate ) ) IF EXIST "C:\Riot Games\League of Legends" ( set LOL_PATH="C:\Riot Games\League of Legends" goto runSpectate ) IF EXIST "D:\Riot Games\League of Legends" ( set LOL_PATH="D:\Riot Games\League of Legends" goto runSpectate ) IF EXIST "C:\Program Files\Riot Games\League of Legends" ( set LOL_PATH="C:\Program Files\Riot Games\League of Legends" goto runSpectate ) IF EXIST "C:\Program Files (x86)\Riot Games\League of Legends" ( set LOL_PATH="C:\Program Files (x86)\Riot Games\League of Legends" goto runSpectate ) IF EXIST "C:\Program Files\League of Legends" ( set LOL_PATH="C:\Program Files\League of Legends" goto runSpectate ) IF EXIST "C:\Program Files (x86)\League of Legends" ( set LOL_PATH="C:\Program Files (x86)\League of Legends" goto runSpectate ) IF EXIST "D:\Program Files\Riot Games\League of Legends" ( set LOL_PATH="D:\Program Files\Riot Games\League of Legends" goto runSpectate ) IF EXIST "D:\Program Files (x86)\Riot Games\League of Legends" ( set LOL_PATH="D:\Program Files (x86)\Riot Games\League of Legends" goto runSpectate ) IF EXIST "D:\Program Files\League of Legends" ( set LOL_PATH="D:\Program Files\League of Legends" goto runSpectate ) IF EXIST "D:\Program Files (x86)\League of Legends" ( set LOL_PATH="D:\Program Files (x86)\League of Legends" goto runSpectate ) goto notfound :pidFound set "lcpath=" for /f "skip=1delims=" %%a in ( 'wmic process where "ProcessID=%LOL_PID%" get ExecutablePath' ) do if not defined lcpath set "lcpath=%%a" For %%A in ("%lcpath%") do ( Set LOL_PATH=%%~dpA ) goto runSpectate :runSpectate cls for /f "tokens=* delims= " %%a in ("%LOL_PATH%") do set LOL_PATH=%%a for /l %%a in (1,1,100) do if "!LOL_PATH:~-1!"==" " set LOL_PATH=!LOL_PATH:~0,-1! cd /D %LOL_PATH% for /f "tokens=1,* delims=" %%i in ('type Config\LeagueClientSettings.yaml ^| find /i "locale:"') do ( set line=%%i call :Trim trimmed !line! SET locale=!trimmed:~9,-1! ) cd Game if exist "League of Legends.exe" ( goto start ) goto notfound :start dir %~dp0\*.rofl /B>%~dp0\a1.txt dir %~dp0\*.rofl /B for /f "tokens=1*" %%a in (%~dp0\a1.txt) do set b1=%%a @start "" "League of Legends.exe" "%~dp0/%b1%" "-GameBaseDir=.." "-Region=TW2" "-PlatformID=TW2" "-Locale=zh_TW" "-SkipBuild" "-EnableCrashpad=true" "-EnableLNP" "-UseDX11=1:1" "-UseMetal=0:1" "-UseNewX3D" "-UseNewX3DFramebuffers" del %~dp0\a1.txt goto exit :Trim SetLocal EnableDelayedExpansion set Params=%* for /f "tokens=1*" %%a in ("!Params!") do EndLocal & set %1=%%b exit /b :notfound cls echo Cannot find your League of Legends installation. (If the issue persists, contact [email protected]) set /p manualFolder="Please enter your League of Legends installation path: " call :Trim manualFolder !manualFolder! IF "!manualFolder!" NEQ "" ( echo !manualFolder! > "%APPDATA%\LoG_lolinstallpath.txt" ) goto start :exit |
Direct link: https://paste.plurk.com/show/KoivLvdJ6CMqfujiPhvn