Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. @ECHO off
  2. COLOR 03
  3.  
  4. REM --- Created by BWBellairs --- Version: 1.2.27
  5.  
  6. setlocal EnableExtensions EnableDelayedExpansion
  7.  
  8. :do_choice
  9. TASKLIST /FI "IMAGENAME eq Steam.exe" 2>NUL | find /I /N "Steam.exe">NUL
  10. IF "%ERRORLEVEL%"=="0" (
  11. ECHO Please close Steam or start updating your games in steam now.
  12. ECHO If you don't close steam, you will be taken staight to shutdown options
  13. TIMEOUT /t 20
  14. GOTO :do_shutdown_options
  15. )
  16.  
  17. SET /p st_delay="Enter Number of Seconds to wait before starting steam: "
  18. ECHO:
  19.  
  20. :do_shutdown_options
  21. SET /p sh_delay_active="Want to shutdown after a delay or use Smart Shutdown? y/n "
  22. ECHO:
  23.  
  24. SET "smart_shutdown_enabled="
  25. SET "sh_mode="
  26. SET "sh_delay="
  27. IF "%sh_delay_active%"=="y" (
  28.  
  29. SET /p smart_shutdown_enabled="Would you like to enable Smart Shutdown? Computer will shutdown when it has detected that Steam isn't downloading any updates for games. y/n "
  30.  
  31. IF NOT "!smart_shutdown_enabled!" EQU "y" (
  32. SET /p sh_delay="Enter Number of Seconds to wait before shutting down (Do an hour after the download eta) "
  33.  
  34. )
  35.  
  36. SET /p sh_mode="Shutdown mode restart(r) shutdown (s): "
  37.  
  38. ECHO:
  39.  
  40. )
  41.  
  42. TASKLIST /FI "IMAGENAME eq Steam.exe" 2>NUL | find /I /N "Steam.exe">NUL
  43. IF "%ERRORLEVEL%"=="1" (
  44.  
  45. IF not defined st_delay (
  46. ECHO Looks like Steam isn't active... Did the Process exit?
  47. SET /p st_delay="Enter Number of Seconds to wait before starting steam: "
  48. ECHO:
  49. )
  50.  
  51. ECHO Starting Steam in !st_delay! seconds
  52. TIMEOUT /t !st_delay! /nobreak
  53.  
  54.  
  55. ECHO:
  56. ECHO Starting Steam
  57.  
  58. START steam://
  59.  
  60. ECHO Steam launched
  61.  
  62. )
  63.  
  64. if not defined smart_shutdown_enabled echo 1
  65.  
  66. If "%sh_delay_active%" EQU "y" (
  67.  
  68. IF NOT "%smart_shutdown_enabled%" EQU "y" (
  69. ECHO Starting Shutdown delay with mode %sh_mode%
  70.  
  71. TIMEOUT /t %sh_delay% /nobreak
  72.  
  73. ECHO Preparing to shutdown... if you wish to stop this, press WINDOWS KEY, type 'shutdown /a' then press ENTER
  74. ECHO Shutting down...
  75.  
  76. SHUTDOWN /%sh_mode% /t 120
  77. PAUSE
  78. EXIT
  79. )
  80. )
  81.  
  82. SET \A shutdown_attempts=0
  83. If "%sh_delay_active%" EQU "y" (
  84.  
  85. IF "%smart_shutdown_enabled%" EQU "y" (
  86.  
  87. ECHO "Waiting for Steam to cease activity before shutting down (SmartShutdown)"
  88.  
  89. :start_loop
  90. FOR /f "tokens=2 delims=," %%c in ('typeperf "\Process(Steam)\IO Data Operations/sec" -si 1 -sc 1 ^| find /V "\\"') do (
  91.  
  92. IF %%c EQU "0.000000%" (
  93. SET /a shutdown_attempts=!shutdown_attempts!+1
  94. ) ELSE (
  95. SET /a shutdown_attempts=0
  96. )
  97.  
  98. IF !shutdown_attempts!==10 GOTO :end_loop
  99.  
  100. GOTO :start_loop
  101.  
  102. :end_loop
  103. ECHO Preparing to shutdown... if you wish to stop this, press WINDOWS KEY, type 'shutdown /a' then press ENTER
  104. ECHO Shutting down...
  105.  
  106. SHUTDOWN /%sh_mode% /t 120
  107. PAUSE
  108. EXIT
  109. )
  110. )
  111. )
  112.  
  113. ECHO:
  114. ECHO Program finished
  115. ECHO:
  116. ECHO -----------------------------------
  117. ECHO BWBellairs' tips his fedora at you.
  118. ECHO -----------------------------------
  119. ECHO:
  120. ECHO Press any key to exit
  121.  
  122. PAUSE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement