64 lines
2.1 KiB
Batchfile
64 lines
2.1 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions EnableDelayedExpansion
|
|
|
|
set "TARGET_URL=%~1"
|
|
if not defined TARGET_URL set "TARGET_URL=http://localhost:8081"
|
|
|
|
set "BROWSER_PATH="
|
|
set "BROWSER_KIND="
|
|
|
|
for %%B in (chrome.exe msedge.exe firefox.exe) do if not defined BROWSER_PATH (
|
|
for /f "delims=" %%I in ('where %%B 2^>nul') do if not defined BROWSER_PATH (
|
|
set "BROWSER_PATH=%%I"
|
|
set "BROWSER_KIND=%%~nB"
|
|
)
|
|
)
|
|
|
|
if not defined BROWSER_PATH if not defined BROWSER_KIND (
|
|
for %%P in (
|
|
"%ProgramFiles%\Google\Chrome\Application\chrome.exe"
|
|
"%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe"
|
|
"%LocalAppData%\Google\Chrome\Application\chrome.exe"
|
|
) do if not defined BROWSER_PATH if exist "%%~fP" (
|
|
set "BROWSER_PATH=%%~fP"
|
|
set "BROWSER_KIND=chrome"
|
|
)
|
|
)
|
|
|
|
if not defined BROWSER_PATH if not defined BROWSER_KIND (
|
|
for %%P in (
|
|
"%ProgramFiles%\Microsoft\Edge\Application\msedge.exe"
|
|
"%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe"
|
|
"%LocalAppData%\Microsoft\Edge\Application\msedge.exe"
|
|
) do if not defined BROWSER_PATH if exist "%%~fP" (
|
|
set "BROWSER_PATH=%%~fP"
|
|
set "BROWSER_KIND=edge"
|
|
)
|
|
)
|
|
|
|
if not defined BROWSER_PATH if not defined BROWSER_KIND (
|
|
for %%P in (
|
|
"%ProgramFiles%\Mozilla Firefox\firefox.exe"
|
|
"%ProgramFiles(x86)%\Mozilla Firefox\firefox.exe"
|
|
"%LocalAppData%\Mozilla Firefox\firefox.exe"
|
|
) do if not defined BROWSER_PATH if exist "%%~fP" (
|
|
set "BROWSER_PATH=%%~fP"
|
|
set "BROWSER_KIND=firefox"
|
|
)
|
|
)
|
|
|
|
if not defined BROWSER_PATH (
|
|
echo No supported browser was found.
|
|
echo Tried Chrome, Edge, and Firefox in PATH and common install locations.
|
|
exit /b 1
|
|
)
|
|
|
|
set "KIOSK_PROFILE=%LocalAppData%\PulseSignage\kiosk-browser-profile"
|
|
if not exist "!KIOSK_PROFILE!" mkdir "!KIOSK_PROFILE!"
|
|
|
|
echo Launching !BROWSER_KIND! in kiosk mode: !TARGET_URL!
|
|
if /I "!BROWSER_KIND!"=="firefox" (
|
|
start "" "!BROWSER_PATH!" -no-remote -profile "!KIOSK_PROFILE!" -new-window -kiosk "!TARGET_URL!"
|
|
) else (
|
|
start "" "!BROWSER_PATH!" --disable-notifications --no-first-run --no-default-browser-check --new-window --kiosk --user-data-dir="!KIOSK_PROFILE!" "!TARGET_URL!"
|
|
) |