-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSteam_No_Browser.cmd
141 lines (128 loc) · 4.86 KB
/
Steam_No_Browser.cmd
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
:: Configuration Section
:: Steam directory
set "steam_path=%SystemDrive%\Program Files (x86)\Steam"
:: Game to launch
set "app_id=368260"
:: Time in seconds to wait for Steam to start
set "init_time=20"
:: Time in seconds before giving up on webhelper starting
set /a "max_wait_for_update=90"
:: Check if Steam.exe exists in path, if not print error.
if not exist "!steam_path!\steam.exe" (
call :PrntBox PathError
pause
exit /b 1
)
echo Force closing Steam if running, and ensuring steamwebhelper is available for launch.
:: Kill Steam if it's running
taskkill /f /im "steam.exe" 2>nul
:: Restore binary as steam requires it to initialize.
call :BinaryDance "hiddenwebhelper" "steamwebhelper.exe"
echo.
echo Launching Steam and App #!app_id!.
:: Open steam and specified app
start "" "!steam_path!\steam.exe" steam://rungameid/!app_id! --disable-background-networking --enable-low-end-device-mode --single-process -cef-single-process -skipinitialbootstrap -quicklogin -oldtraymenu -silent
echo.
echo Waiting to make sure Steam has launched before killing steamwebhelper
echo (Note, if this timing doesn't work for you, just modify init_time in the script.)
:: Only continue if steamwebhelper is running in case steam is updating
set /a "count=0"
:wait_for_steamwebhelper
tasklist | findstr /i "steamwebhelper.exe" >nul 2>&1 && goto :steamwebhelper_started
set /a "count+=1"
if !count! lss !max_wait_for_update! (
:: Using ping as a sleep because it has more accurate timing, and a countdown is not needed.
ping -n 2 localhost >nul
goto :wait_for_steamwebhelper
)
call :PrntBox TimeoutError
pause
exit /b 1
:steamwebhelper_started
:: Allow a few seconds for steam to initialize/login
timeout /t !init_time! /nobreak
echo.
echo Killing webhelper and renaming the exe.
:: Hide binary and kill the process
call :BinaryDance "steamwebhelper.exe" "hiddenwebhelper" "kill"
:: Prints a message instructing the user to keep the window open and close Steam when done.
call :PrntBox WaitInstruction
:: Wait for steam to be closed and then rename webhelper back.
:wait_to_fix
:: Using ping as a sleep because it has more accurate timing, and a countdown is not needed.
ping -n 11 localhost >nul
tasklist /fi "imagename eq steam.exe" 2>nul | find /i "steam.exe">nul 2>&1
IF ERRORLEVEL 1 (
call :BinaryDance "hiddenwebhelper" "steamwebhelper.exe"
echo Program complete. You may close the window.
) ELSE (
goto wait_to_fix
)
pause
exit/b 0
:: Used for renaming steamwebhelper back and forth.
:: Delete the source if the destination already exists.
:: Also optionally kill the process.
:: Parameters:
:: %1 - Source filename
:: %2 - Destination filename
:: %3 - "kill" to kill the process with the name %1 (OPTIONAL)
:BinaryDance
for %%a in ("cef.win7", "cef.win7x64") do (
set "src=!steam_path!\bin\cef\%%~a\%~1"
set "dest=!steam_path!\bin\cef\%%~a\%~2"
if exist "!src!" (
if "%~3"=="kill" (
taskkill /f /im "%~1"
if errorlevel 1 (
pause
exit /b 1
)
)
if exist "!dest!" (
del "!src!" >nul 2>&1 && echo %~1 deleted as %~2 already exists
) else (
move "!src!" "!dest!" >nul && echo %~1 renamed to %~2
)
)
)
exit/b
:: psuedo switch to print formatted message boxes for errors and instructions.
:PrntBox
echo.
goto :%1
echo Error: Bad paramater passed to PrntBox. I should make a better error message for this...
pause
exit /b
:PathError
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º "Steam.exe" not found. Please ensure º
echo º the 'steam_path' variable in the script º
echo º matches your steam installation folder. º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
exit /b
:TimeoutError
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Steamwebhelper has not started for !max_wait_for_update! seconds. º
echo º either Steam has not launched or it is updating. º
echo º If !max_wait_for_update! seconds is not long enough, you can modify º
echo º the 'max_wait_for_update' variable in the script º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
exit /b
:WaitInstruction
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Leave this window open and when done close Steam either º
echo º by right clicking it on the taskbar, or in the task manager º
echo º This ensures things are put back how they should be. º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo.
exit /b