cybermaniac
New member
Hey guys,
I have built the following batch file:
Most of this works, except for one bit that I am trying to implement:
this is what I have so far:
What I am trying to do is this:
Back up the user's current desktop background, chosen screen saver, and misc values that go with it.
now, exporting the registry file is easy as seen here:
But to be able to actually restore the background + screensaver, one would ideally need to be able to get the dynamic value of the wallpaper and screensaver path + file name.
Does anyone know how I would go about this, WITHOUT using an external exe?
Thanks guys!
I have built the following batch file:
Code:
@echo off
REM Snell Backup Batch File
REM Created and Modified by Alex Lane
COLOR 0e
:: variables
set dateNtime="%date:~0,2%-%date:~3,2%-%date:~6,6%"
set drive=H:\Private\ITBackup\%dateNtime%
set backupcmd=xcopy /s /c /d /e /h /i /r /y /k /v
:Start
cls
echo Press 1 to Backup Files.
echo Press 2 to Restore Files.
echo Press 3 to Restore Firefox Profile.
echo Press 4 to Quit.
set /p userinp=Choice #:
set userinp=%userinp:~0,1%
if "%userinp%"=="1" goto 1
if "%userinp%"=="2" goto 2
if "%userinp%"=="3" goto 3
if "%userinp%"=="4" goto 4
echo '%userinp%' is not a valid choice, press any key to try again.
pause>nul
goto start
:1
echo ### Backing up files...
echo ### Setting backup drive as: %drive%
echo ### Backing up Custom Dictionary
%backupcmd% "%USERPROFILE%\Application Data\microsoft\proof" "%drive%\Outlookbackup\Proof"
echo ### Backing up Outlook Autocomplete
%backupcmd% "%USERPROFILE%\Application Data\microsoft\outlook" "%drive%\Outlookbackup\Outlook"
echo ### Backing up Outlook Signatures
%backupcmd% "%USERPROFILE%\Application Data\microsoft\signatures" "%drive%\Outlookbackup\Signatures"
echo ### Backing up Internet Exlorer Favourites
%backupcmd% "%USERPROFILE%\Favorites" "%drive%\Favorites"
REM ### You now have the final countdown stuck in your head
echo ### Backing up Firefox Profile
%backupcmd% "%USERPROFILE%\Application Data\Mozilla\Firefox\Profiles" "%drive%\Firefox\Profiles"
echo ### Backing up My Documents
%backupcmd% "%USERPROFILE%\My Documents" "%drive%\My Documents"
echo ### Backing up Desktop
%backupcmd% "%USERPROFILE%\Desktop" "%drive%\Desktop"
echo ### Backing up Desktop Settings (Wallpaper, screensaver etc)
reg export "HKCU\Control Panel\Desktop" "%drive%\Desktop Settings Backup\backup.REG"
echo ### Listing all programs installed on the computer
regedit /e %temp%\regexport.txt "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall"
find "DisplayName" %temp%\regexport.txt >%temp%\regprogs.txt
for /f "tokens=2 delims==" %%a in (%temp%\regprogs.txt) do echo %%~a >>"%drive%\installedprogs.txt"
del %temp%\regexport.txt
del %temp%\regprogs.txt
goto endbackup
:2
echo ### Restoring files...
echo ### Restoring files from %drive%
echo ### Restoring Custom Dictionary
%backupcmd% "%drive%\Outlookbackup\Proof" "%USERPROFILE%\Application Data\microsoft\proof"
echo ### Restoring Outlook Autocomplete
%backupcmd% "%drive%\Outlookbackup\Outlook" "%USERPROFILE%\Application Data\microsoft\outlook"
REM ### You have lost the game
echo ### Restoring Outlook Signatures
%backupcmd% "%drive%\Outlookbackup\Signatures" "%USERPROFILE%\Application Data\microsoft\signatures"
echo ### Restoring Internet Exlorer Favourites
%backupcmd% "%drive%\Favorites" "%USERPROFILE%\Favorites"
echo ### Restoring My Documents
%backupcmd% "%drive%\My Documents" "%USERPROFILE%\My Documents"
echo ### Restoring Desktop
%backupcmd% "%drive%\Desktop" "%USERPROFILE%\Desktop"
goto endrestore
:3
echo ### Restoring Firefox Profile
%backupcmd% "%drive%\Firefox\Profiles" "%USERPROFILE%\Application Data\Mozilla\Firefox\Profiles"
goto endrestore
:endbackup
cls
echo Backup Complete!
echo.
echo.
echo.
echo Thank you for using the IT Department's Profile autobackup facility
echo.
echo Your Backup is located at %drive%
echo Please press any key to exit
pause>nul
exit
:endrestore
cls
echo Restore Complete!
echo.
echo.
echo.
echo Thank you for using the IT Department's Profile autobackup facility
echo.
echo Your Backup has been restored from %drive%
echo Please press any key to exit
pause>nul
exit
:4
reg query "HKCU\Control Panel\Desktop" /v ConvertedWallpaper > "H:\Private\backup.txt"
find ConvertedWallpaper "H:\Private\wpexp.txt" "H:\Private\Wallpaper.txt"
set wallpaper < "H:\Private\Wallpaper.txt"
pause
cls
echo Thank you for using the IT Department's Profile autobackup facility
echo.
echo Please press any key to exit
pause>nul
exit
Most of this works, except for one bit that I am trying to implement:
this is what I have so far:
Code:
reg query "HKCU\Control Panel\Desktop" /v ConvertedWallpaper > "H:\Private\backup.txt"
find ConvertedWallpaper "H:\Private\wpexp.txt" "H:\Private\Wallpaper.txt"
set wallpaper < "H:\Private\Wallpaper.txt"
What I am trying to do is this:
Back up the user's current desktop background, chosen screen saver, and misc values that go with it.
now, exporting the registry file is easy as seen here:
Code:
echo ### Backing up Desktop Settings (Wallpaper, screensaver etc)
reg export "HKCU\Control Panel\Desktop" "%drive%\Desktop Settings Backup\backup.REG"
But to be able to actually restore the background + screensaver, one would ideally need to be able to get the dynamic value of the wallpaper and screensaver path + file name.
Does anyone know how I would go about this, WITHOUT using an external exe?
Thanks guys!