Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::Made by RU$$ [http://russdev.mooo.com/]
- @Echo off
- Title Set Custom Windows7 Login Background
- ::Check if cmd is open as admin
- NET SESSION >nul 2>&1
- IF %ERRORLEVEL% EQU 0 (goto :BEGIN) ELSE (goto :NOTADMIN)
- :NOTADMIN
- cls
- echo ERROR: You need to run as an Administrator!
- echo.
- pause
- exit
- :BEGIN
- ::Check if user is on Windows7
- set VER=
- 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)))
- FOR /F "tokens=3 delims= " %%g IN ('wmic os get caption ^|find /I "Windows"') DO (IF /I "%%g"=="7" (goto :VALID) ELSE (goto :NOTVALID))
- :NOTVALID
- echo ERROR: You are not running windows 7.
- echo.
- pause
- exit
- :VALID
- ::Check for reg key then Add/Change Reg Key if needed.
- reg query HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background\ /v OEMBackground | find "0x1"
- IF %errorlevel%==0 (goto :VALID2) else (goto :MISSING1)
- :MISSING1
- cls
- reg.exe add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background" /f /v OEMBackground /t REG_DWORD /d 1
- cls
- echo MESSAGE: REG Key not found. Generating now.
- echo.
- pause
- goto :VALID2
- :VALID2
- ::Check for folders then create new folders if needed.
- IF EXIST C:\Windows\System32\oobe\info (goto :VALID3) ELSE (goto :MISSING2)
- :MISSING2
- cls
- echo MESSAGE: A folder(s) was not found. Generating now. [1]
- CD C:\Windows\System32\oobe
- MKDIR info
- echo.
- pause
- goto :VALID3
- :VALID3
- ::Check for folders then create new folders if needed.
- IF EXIST C:\Windows\System32\oobe\info\backgrounds (goto :MENU) ELSE (goto :MISSING3)
- :MISSING3
- cls
- echo MESSAGE: A folder(s) was not found. Generating now. [2]
- CD C:\Windows\System32\oobe\info
- MKDIR backgrounds
- echo.
- pause
- goto :MENU
- :MENU
- cls
- SET Image=
- SET Status=
- SET Status2=
- SET mypath=%~dp0
- ::Check if the image exists
- IF EXIST %mypath:~0,-1%\backgroundDefault.jpg (set Image=Found! & set Status=1) ELSE (set Image=Not Found! & set Status2=1)
- echo ********************************************************
- echo * Welcome %username% ^| Status - Image: %Image%
- echo ********************************************************
- echo.
- echo --------------------------------------------------------
- echo - Instructions:
- echo -
- echo - 1. Your file must be labeled backgroundDefault.jpg
- echo - 2. Your file must less than 250kb in size
- echo - 3. Your file must be placed in the same directory
- echo --------------------------------------------------------
- echo.
- echo --------------------------------------------------------
- echo - Options:
- echo -
- echo - exit [Exits this window]
- echo - enter [1st. Refresh ^| 2nd+. Reroll last command]
- echo - delete [Removes any backgrounds - Revert default]
- echo --------------------------------------------------------
- echo.
- IF "%Status%"=="1" (goto :1) ELSE (IF "%Status2%"=="1" (goto :2) ELSE ((goto :MENU))
- :1
- set /p start=Would you wish to move the image [y/n]:
- IF /I '%start%'=='exit' exit
- IF /I '%start%'=='Exit' exit
- IF /I '%start%'=='n' goto exit
- IF /I '%start%'=='N' goto exit
- IF /I '%start%'=='' goto :MENU
- IF /I '%start%'=='y' goto :START
- IF /I '%start%'=='Y' goto :START
- IF /I '%start%'=='delete' goto :DEL
- IF /I '%start%'=='Delete' goto :DEL
- goto :MENU
- :2
- set /p wait=Waiting for image..
- IF /I '%wait%'=='' goto :MENU
- IF /I '%wait%'=='exit' exit
- IF /I '%wait%'=='Exit' exit
- IF /I '%wait%'=='delete' goto :DEL
- IF /I '%wait%'=='Delete' goto :DEL
- goto :MENU
- :START
- cls
- ::Move image
- SET mypath=%~dp0
- move "%mypath:~0,-1%\backgroundDefault.jpg" "C:\Windows\System32\oobe\info\backgrounds"
- cls
- ::Wait 5 seconds
- echo Please wait 5 seconds while we move your file.
- echo --------------------------------------------------------
- PING localhost -n 5 >NUL
- cls
- ::Check if image was moved.
- IF EXIST C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg (goto :FINISHED) ELSE (goto :ERROR)
- :ERROR
- cls
- echo ERROR: There was a problem moving your image. (Is it open in another process?)
- echo.
- pause
- goto :MENU
- :FINISHED
- cls
- echo MESSAGE: The file was successfully moved.
- echo.
- pause
- exit
- :DEL
- cls
- ::Check if image exists.
- IF EXIST C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg (goto :CONTINUE) ELSE (goto :ERROR3)
- :CONTINUE
- DEL /Q /F C:\Windows\System32\oobe\info\backgrounds
- ::Wait 5 seconds
- echo Please wait 5 seconds while we delete your file.
- echo --------------------------------------------------------
- PING localhost -n 5 >NUL
- cls
- ::Check if image was deleted.
- IF EXIST C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg (goto :ERROR2) ELSE (goto :FINISHED2)
- :ERROR2
- cls
- echo ERROR: There was a problem deleting your image. (Is it open in another process?)
- echo.
- pause.
- goto :MENU
- :ERROR3
- cls
- echo ERROR: There is no image to delete.
- echo.
- pause.
- goto :MENU
- :FINISHED2
- cls
- echo MESSAGE: The file was deleted successfully.
- echo.
- pause.
- goto :MENU
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement