SHARE
TWEET

Set Custom Windows7 Login Background [Fixed] (Batch)

Imthedude025 Jan 8th, 2018 (edited) 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ::Made by RU$$ [http://russdev.mooo.com/]
  2. @Echo off
  3. Title Set Custom Windows7 Login Background
  4.  
  5. ::Check if cmd is open as admin
  6. NET SESSION >nul 2>&1
  7. IF %ERRORLEVEL% EQU 0 (goto :BEGIN) ELSE (goto :NOTADMIN)
  8.  
  9. :NOTADMIN
  10. cls
  11. echo ERROR: You need to run as an Administrator!
  12. echo.
  13. pause
  14.  
  15. exit
  16.  
  17. :BEGIN
  18.  
  19. ::Check if user is on Windows7
  20. set VER=
  21.  
  22. FOR /F "tokens=4-5 delims=, " %%g IN ('wmic os get caption ^|find /I "Windows"') DO (IF /I "%%g"=="2003" (set OSVER=%%g) ELSE (IF /I "%%g"=="2008" (IF "%%g%%h"=="2008R2" (set OSVER=%%g %%h) ELSE set OSVER=%%g)))
  23.  
  24. FOR /F "tokens=3 delims= " %%g IN ('wmic os get caption ^|find /I "Windows"') DO (IF /I "%%g"=="7" (goto :VALID) ELSE (goto :NOTVALID))
  25.  
  26. :NOTVALID
  27. echo ERROR: You are not running windows 7.
  28. echo.
  29. pause
  30. exit
  31.  
  32. :VALID
  33.  
  34. ::Check for reg key then Add/Change Reg Key if needed.
  35. reg query HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background\ /v OEMBackground | find "0x1"
  36.  
  37. IF %errorlevel%==0 (goto :VALID2) else (goto :MISSING1)
  38.  
  39. :MISSING1
  40. cls
  41.  
  42. reg.exe add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background" /f /v OEMBackground /t REG_DWORD /d 1
  43.  
  44. cls
  45. echo MESSAGE: REG Key not found. Generating now.
  46. echo.
  47. pause
  48. goto :VALID2
  49.  
  50. :VALID2
  51.  
  52. ::Check for folders then create new folders if needed.
  53. IF EXIST C:\Windows\System32\oobe\info (goto :VALID3) ELSE (goto :MISSING2)
  54.  
  55. :MISSING2
  56. cls
  57. echo MESSAGE: A folder(s) was not found. Generating now. [1]
  58.  
  59. CD C:\Windows\System32\oobe
  60. MKDIR info
  61.  
  62. echo.
  63. pause
  64. goto :VALID3
  65.  
  66. :VALID3
  67.  
  68. ::Check for folders then create new folders if needed.
  69. IF EXIST C:\Windows\System32\oobe\info\backgrounds (goto :MENU) ELSE (goto :MISSING3)
  70.  
  71. :MISSING3
  72. cls
  73. echo MESSAGE: A folder(s) was not found. Generating now. [2]
  74.  
  75. CD C:\Windows\System32\oobe\info
  76. MKDIR backgrounds
  77.  
  78. echo.
  79. pause
  80. goto :MENU
  81.  
  82. :MENU
  83. cls
  84.  
  85. SET Image=
  86. SET Status=
  87. SET Status2=
  88. SET mypath=%~dp0
  89.  
  90. ::Check if the image exists
  91. IF EXIST %mypath:~0,-1%\backgroundDefault.jpg (set Image=Found! & set Status=1) ELSE (set Image=Not Found! & set Status2=1)
  92.  
  93. echo ********************************************************
  94. echo * Welcome %username% ^| Status - Image: %Image%
  95. echo ********************************************************
  96. echo.
  97. echo --------------------------------------------------------
  98. echo - Instructions:
  99. echo -
  100. echo - 1. Your file must be labeled backgroundDefault.jpg
  101. echo - 2. Your file must less than 250kb in size
  102. echo - 3. Your file must be placed in the same directory
  103. echo --------------------------------------------------------
  104. echo.
  105. echo --------------------------------------------------------
  106. echo - Options:
  107. echo -
  108. echo - exit    [Exits this window]
  109. echo - enter   [1st. Refresh ^| 2nd+. Reroll last command]
  110. echo - delete  [Removes any backgrounds - Revert default]
  111. echo --------------------------------------------------------
  112. echo.
  113. IF "%Status%"=="1" (goto :1) ELSE (IF "%Status2%"=="1" (goto :2) ELSE ((goto :MENU))
  114.  
  115. :1
  116. set /p start=Would you wish to move the image [y/n]:
  117.  
  118. IF /I '%start%'=='exit' exit
  119. IF /I '%start%'=='Exit' exit
  120. IF /I '%start%'=='n' goto exit
  121. IF /I '%start%'=='N' goto exit
  122. IF /I '%start%'=='' goto :MENU
  123. IF /I '%start%'=='y' goto :START
  124. IF /I '%start%'=='Y' goto :START
  125. IF /I '%start%'=='delete' goto :DEL
  126. IF /I '%start%'=='Delete' goto :DEL
  127.  
  128. goto :MENU
  129.  
  130. :2
  131. set /p wait=Waiting for image..
  132.  
  133. IF /I '%wait%'=='' goto :MENU
  134. IF /I '%wait%'=='exit' exit
  135. IF /I '%wait%'=='Exit' exit
  136. IF /I '%wait%'=='delete' goto :DEL
  137. IF /I '%wait%'=='Delete' goto :DEL
  138.  
  139. goto :MENU
  140.  
  141. :START
  142. cls
  143.  
  144. ::Move image
  145. SET mypath=%~dp0
  146. move "%mypath:~0,-1%\backgroundDefault.jpg" "C:\Windows\System32\oobe\info\backgrounds"
  147. cls
  148.  
  149. ::Wait 5 seconds
  150. echo Please wait 5 seconds while we move your file.
  151. echo --------------------------------------------------------
  152. PING localhost -n 5 >NUL
  153. cls
  154.  
  155. ::Check if image was moved.
  156. IF EXIST C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg (goto :FINISHED) ELSE (goto :ERROR)
  157.  
  158. :ERROR
  159. cls
  160. echo ERROR: There was a problem moving your image. (Is it open in another process?)
  161. echo.
  162. pause
  163.  
  164. goto :MENU
  165.  
  166. :FINISHED
  167. cls
  168. echo MESSAGE: The file was successfully moved.
  169. echo.
  170. pause
  171.  
  172. exit
  173.  
  174. :DEL
  175. cls
  176.  
  177. ::Check if image exists.
  178. IF EXIST C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg (goto :CONTINUE) ELSE (goto :ERROR3)
  179.  
  180. :CONTINUE
  181.  
  182. DEL /Q /F C:\Windows\System32\oobe\info\backgrounds
  183.  
  184. ::Wait 5 seconds
  185. echo Please wait 5 seconds while we delete your file.
  186. echo --------------------------------------------------------
  187. PING localhost -n 5 >NUL
  188. cls
  189.  
  190. ::Check if image was deleted.
  191. IF EXIST C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg (goto :ERROR2) ELSE (goto :FINISHED2)
  192.  
  193. :ERROR2
  194. cls
  195. echo ERROR: There was a problem deleting your image. (Is it open in another process?)
  196. echo.
  197. pause.
  198.  
  199. goto :MENU
  200.  
  201. :ERROR3
  202. cls
  203. echo ERROR: There is no image to delete.
  204. echo.
  205. pause.
  206.  
  207. goto :MENU
  208.  
  209. :FINISHED2
  210. cls
  211. echo MESSAGE: The file was deleted successfully.
  212. echo.
  213. pause.
  214.  
  215. goto :MENU
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top