@echo off setlocal chcp 932 > nul echo ======================================================== echo WSL サービスのクラッシュ時自動再起動設定 (管理者権限) echo ======================================================== echo. net session >nul 2>&1 if %errorlevel% neq 0 ( echo [情報] 管理者権限に昇格して実行します... powershell -NoProfile -Command "Start-Process cmd.exe -ArgumentList '/c \"\"%~f0\"\"' -Verb RunAs" exit /b ) echo [実行中] WSLService のクラッシュ時自動再起動を設定しています... sc.exe failure WSLService reset= 86400 actions= restart/3000/restart/5000/restart/10000 echo. echo [確認] 現在の障害回復設定: sc.exe qfailure WSLService echo. echo ======================================================== echo 設定が完了しました。何かキーを押すと閉じます。 echo ======================================================== pause