Overclock.net › Forums › Software, Programming and Coding › Other Software › RocketDock Backup and Restore Utility!
New Posts  All Forums:Forum Nav:

RocketDock Backup and Restore Utility!

post #1 of 8
Thread Starter 
Download the latest version v1.2.4: http://www.sendspace.com/file/bpawd5
See here for what's new

(The code below will not match exactly with the new utility, but the functionality is more or less the same so you can still view that for reference)

-----------------------------------------------

As of late something on my system is interfering with RocketDock which constantly pisses off RocketDock, causing it to give me a "RocketDock has stopped working" error on OS boot. The only resolution was to either 1) launch the program again, restore the default icons, and re-do everything, or 2) make a backup of the entire Program Files folder and just restore it.

I've been doing option two quite a lot, and today when I did my OS boot and I was greeted by the "RocketDock was stopped working" error I had enough.

So I went ahead and coded an automated batch file to take care of that.

Update 7/27/2011: I've combined both utilities into one tool and added a ton of features. I'd suggest using that (click here for link) but the below downloads will still be available.


RocketDock Backup and Restoration Utility
By kiwiasian@OCN


Downloads
Download the backup utility: http://www.sendspace.com/file/vt0dlc
Download the restoration utility: http://www.sendspace.com/file/5jcn8d
...Or if the links magically break themselves, download the attachment in this post.

How it works
In both utilities, the pre-set variables are as follows:
The directory used for storing backups: %AppData%\\RocketDock Backup
The directory of the program files: C:\\Program Files (x86)\\RocketDock*
*This means the batch file in its unmodified form will work for 64-bit versions of Windows.

Of course, like all other batch files, these directories can be modified at will to keep the backup on a different drive, and/or change the directory of the RocketDock application (C:\\Program Files\\RocketDock, for example, in case you are using 32-bit Windows or if RocketDock ever becomes 64-bit native).
I would assume this works for all editions of Windows, since the directory is %AppData% as opposed to C:\\Users\\%USERNAME%\\AppData

Notes:
-If any command fails, it will just ignore and continue. For example if you did not have a folder named "RocketDock" it will not try to remove it; it will just skip that command.
-Because of the above reason you do not need to set up any folders for this to work. Just run it and go.


Backup utility:

@ECHO OFF
ECHO RocketDock Backup Utility by kiwiasian@OCN
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating backup...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: Backing up RocketDock will overwrite any existing backups. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :yes)
if /i {%ANSWER%}=={yes} (goto :yes)
if /i {%ANSWER%}=={n} (goto :no)
if /i {%ANSWER%}=={no} (goto :no)

:no
ECHO Backup canceled.
pause
exit

:yes
ECHO Backing up files...
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Removing existing backup...
rmdir /s /q "%AppData%\\RocketDock Backup\\RocketDock"
mkdir "%AppData%\\RocketDock Backup\\RocketDock"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating backup...
XCOPY /s /e /q "C:\\Program Files (x86)\\RocketDock" "%AppData%\\RocketDock Backup\\RocketDock"
ECHO Completed.
ECHO Your backup is located in %AppData%\\RocketDock Backup\\RocketDock

pause


Comments and explanations are italicized underneath the line.
@ECHO OFF
This prevents all the processes from being shown, and only the items next to ECHO are shown.
ECHO RocketDock Backup Utility by kiwiasian@OCN
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating backup...
PING 1.1.1.1 -n 1 -w 1000 >NUL
The above does not do anything.
SET /P ANSWER=WARNING: Backing up RocketDock will overwrite any existing backups. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :yes)
if /i {%ANSWER%}=={yes} (goto :yes)
if /i {%ANSWER%}=={n} (goto :no)
if /i {%ANSWER%}=={no} (goto :no)
If you type y or yes, the batch file will skip to the "yes" section and start commands from there.
If you type n or no, the batch file will skip to the "no" section and start commands from there.
Notice however the "no" section is first and has an exit command, preventing the "yes" section from being executed if you so choose no.


:no
ECHO Backup canceled.
pause
This command waits for user response--"press a key to continue"
exit

:yes
ECHO Backing up files...
PING 1.1.1.1 -n 1 -w 1000 >NUL
This forces the batch file to wait for 1000ms, or 1 second. It is pinging a nonexistent IP address, which makes it pause for whatever length of time.
ECHO Removing existing backup...
rmdir /s /q "%AppData%\\RocketDock Backup\\RocketDock"
mkdir "%AppData%\\RocketDock Backup\\RocketDock"
This is deleting the backup folder and recreating it. It is the equivalent of deleting all the contents in the folder.

The reason why I only allowed to have one backup is because the restoration utility will automatically restore from %AppData%\\RocketDock Backup\\RocketDock. If I had multiple backups, I would have to program the restoration utility to look for backup1, backup2, etc. In which case there would be %AppData%\\RocketDock Backup\\RocketDock1, %AppData%\\RocketDock Backup\\RocketDock2, %AppData%\\RocketDock Backup\\RocketDock3, etc.
...Which is something I can do:
SET /P ANSWER=Which backup would you like to restore? (enter a number)
if /i {%ANSWER%}=={3} (goto :backup3)
:backup3
...
...But I'm too lazy to do that.

PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating backup...
XCOPY /s /e /q "C:\\Program Files (x86)\\RocketDock" "%AppData%\\RocketDock Backup\\RocketDock"
This is copying all the data from your Program Files folder to your backup folder.
ECHO Completed.
ECHO Your backup is located in %AppData%\\RocketDock Backup\\RocketDock

pause

TL;DR:
1) Previous backups are deleted
2) Current backup is created


Restoration utility:

@ECHO OFF
ECHO RocketDock Restoration Utility by kiwiasian@OCN
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating restore...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Continue with RocketDock restore? (Y/N)
if /i {%ANSWER%}=={y} (goto :restoreyes)
if /i {%ANSWER%}=={yes} (goto :restoreyes)
if /i {%ANSWER%}=={n} (goto :restoreno)
if /i {%ANSWER%}=={no} (goto :restoreno)

:restoreno
ECHO Restore canceled.
pause
exit

:restoreyes
ECHO Checking if RocketDock.exe is in use and terminating application if it is...
taskkill /f /im RocketDock.exe
ECHO Waiting...2 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...1 second
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Fixing directories...
rmdir /s /q "C:\\Program Files (x86)\\RocketDock"
mkdir "C:\\Program Files (x86)\\RocketDock"
ECHO Copying directories...
XCOPY /s /e /q "%AppData%\\RocketDock Backup\\RocketDock" "C:\\Program Files (x86)\\RocketDock"
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Launch RocketDock? (Y/N)
if /i {%ANSWER%}=={y} (goto :launchyes)
if /i {%ANSWER%}=={yes} (goto :launchyes)
if /i {%ANSWER%}=={n} (goto :launchno)
if /i {%ANSWER%}=={no} (goto :launchno)

:launchno
pause
exit

:launchyes
ECHO Launching RocketDock...
start /d "C:\\Program Files (x86)\\RocketDock" rocketdock.exe
pause


@ECHO OFF
This prevents all the processes from being shown, and only the lines with ECHO in front will be displayed.
ECHO RocketDock Restoration Utility by kiwiasian@OCN
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating restore...
PING 1.1.1.1 -n 1 -w 1000 >NUL
The above does nothing.
SET /P ANSWER=Continue with RocketDock restore? (Y/N)
if /i {%ANSWER%}=={y} (goto :restoreyes)
if /i {%ANSWER%}=={yes} (goto :restoreyes)
if /i {%ANSWER%}=={n} (goto :restoreno)
if /i {%ANSWER%}=={no} (goto :restoreno)
If you type y or yes, the batch file will skip to the "restoreyes" section and start commands from there.
If you type n or no, the batch file will skip to the "restoreno" section and start commands from there.
Notice however the "restoreno" section is first and has an exit command, preventing the "restoreyes" section from being executed if you so choose no.


:restoreno
ECHO Restore canceled.
pause
Waits for user response.
exit

:restoreyes
ECHO Checking if RocketDock.exe is in use and terminating application if it is...
taskkill /f /im RocketDock.exe
This finds the RocketDock.exe application and terminates it so that files can be copied. If it is open, it will force close it (/f) and if it is not open it will just continue on and ignore the command.
ECHO Waiting...2 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...1 second
PING 1.1.1.1 -n 1 -w 1000 >NUL
I had to make the batch file pause for a moment because I noticed even after the process was terminated it still gave me "file is in use" errors. Thus the batch file waits a total of 2 seconds.
ECHO Fixing directories...
rmdir /s /q "C:\\Program Files (x86)\\RocketDock"
mkdir "C:\\Program Files (x86)\\RocketDock"
This deletes the main RocketDock program file directory and recreates it. It accomplishes the same thing as clearing out the folder.
ECHO Copying directories...
XCOPY /s /e /q "%AppData%\\RocketDock Backup\\RocketDock" "C:\\Program Files (x86)\\RocketDock"
This copies all the files from your backup to the program files directory.
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Launch RocketDock? (Y/N)
if /i {%ANSWER%}=={y} (goto :launchyes)
if /i {%ANSWER%}=={yes} (goto :launchyes)
if /i {%ANSWER%}=={n} (goto :launchno)
if /i {%ANSWER%}=={no} (goto :launchno)
Same deal as above, except it redirects to :launchyes or :launchno

:launchno
pause
exit

:launchyes
ECHO Launching RocketDock...
start /d "C:\\Program Files (x86)\\RocketDock" rocketdock.exe
The above command executes a "start program" command. Pretty straightforward.
pause

TL;DR:
1) RocketDock.exe is terminated
2) Progam files folder is cleared
3) Backup is restored
4) User is given choice whether or not to launch the program.

BETA--Universal interface for all utilities

:start
@ECHO OFF
ECHO RocketDock Backup and Restoration Utility
ECHO --------------------------------------------------
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Select a utility to launch.
ECHO 1) Backup utility
ECHO 2) Restoration utility
ECHO 3) Deletion utility
ECHO 4) Exit


set /p x=Enter a number:
IF '%x%' == '%x%' GOTO %x%


:1
ECHO.
ECHO RocketDock Backup Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating backup...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: Backing up RocketDock will overwrite any existing backups. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :yes)
if /i {%ANSWER%}=={yes} (goto :yes)
if /i {%ANSWER%}=={n} (goto :no)
if /i {%ANSWER%}=={no} (goto :no)

:no
ECHO Backup canceled.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:yes
ECHO Backing up files...
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Removing existing backup...
rmdir /s /q "%AppData%\\RocketDock Backup\\RocketDock"
mkdir "%AppData%\\RocketDock Backup\\RocketDock"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating backup...
XCOPY /s /e /q "C:\\Program Files (x86)\\RocketDock" "%AppData%\\RocketDock Backup\\RocketDock"
ECHO Completed.
ECHO Your backup is located in %AppData%\\RocketDock Backup\\RocketDock
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:1_2
ECHO Exiting utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
exit

:1_1
cls
GOTO start


:2
ECHO.
ECHO RocketDock Restoration Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating restore...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Continue with RocketDock restore? (Y/N)
if /i {%ANSWER%}=={y} (goto :restoreyes)
if /i {%ANSWER%}=={yes} (goto :restoreyes)
if /i {%ANSWER%}=={n} (goto :restoreno)
if /i {%ANSWER%}=={no} (goto :restoreno)

:restoreno
ECHO Restore canceled.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:restoreyes
ECHO Checking if RocketDock.exe is in use and terminating application if it is...
taskkill /f /im RocketDock.exe
ECHO Waiting...5 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...4 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...3 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...2 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...1 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
rmdir /s /q "C:\\Program Files (x86)\\RocketDock"
mkdir "C:\\Program Files (x86)\\RocketDock"
ECHO Copying directories...
XCOPY /s /e /q "%AppData%\\RocketDock Backup\\RocketDock" "C:\\Program Files (x86)\\RocketDock"
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Launch RocketDock? (Y/N)
if /i {%ANSWER%}=={y} (goto :launchyes)
if /i {%ANSWER%}=={yes} (goto :launchyes)
if /i {%ANSWER%}=={n} (goto :launchno)
if /i {%ANSWER%}=={no} (goto :launchno)

:launchno
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:launchyes
ECHO Launching RocketDock...
start /d "C:\\Program Files (x86)\\RocketDock" rocketdock.exe
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Process RocketDock.exe initialized
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:3
ECHO.
ECHO RocketDock Backup Deletion Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating deletion...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: This will permanently delete your RocketDock backup. This will also remove the temporary storage folder for this utility. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :deleteyes)
if /i {%ANSWER%}=={yes} (goto :deleteyes)
if /i {%ANSWER%}=={n} (goto :deleteno)
if /i {%ANSWER%}=={no} (goto :deleteno)

:deleteno
ECHO Backup deletion canceled.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:deleteyes
ECHO Deleting backups...
rmdir /s /q "%AppData%\\RocketDock Backup\\"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:4
ECHO Exiting utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
exit


If you find this utility useful, feel free to mod it and add functionality. Or add the multiple backup option that I was too lazy to code lol. I will add your mods in this post.

Enjoy.
Edited by kiwiasian - 7/31/11 at 7:18pm
post #2 of 8
Thread Starter 
Updated to include new all-in-one interface for all utilies.

Fixed bug where some files were in use while trying to restore.
post #3 of 8
Thread Starter 
Working on functionality to automatically detect the OS drive and program files directory, implementing the following lines of code:

Code:
@ECHO OFF
 
Set RegQry=HKLM\\Hardware\\Description\\System\\CentralProcessor\\0
 
REG.exe Query %RegQry% > "%AppData%\\RocketDock Backup\\CheckOS.txt"
 
Find /i "x86" < "%AppData%\\RocketDock Backup\\CheckOS.txt" > StringCheck.txt
 
If %ERRORLEVEL% == 0 (
    set "PROGRAMFILESDIR=Program Files"
) ELSE (
    set "PROGRAMFILESDIR=Program Files (x86)"
)

ECHO Your program files folder is %HOMEDRIVE%\\%PROGRAMFILESDIR%
pause
post #4 of 8
Thread Starter 
I've combined everything into one utility.

New:
-Combined interface for all tools
-Backup deletion tool
-Storage of your backup in a portable, single file
-Ability to change directories
-Backup of registry values to maintain settings from computer-to-computer
-Compatibility with all version of Windows*
-Compatibility with both 32-bit and 64-bit*

*Due to the implementation of preset environmental variables including %HOMEDRIVE%, %PROGRAMFILESDIR%, etc.

Download the new utility here


: : RocketDock Backup and Restoration Utility
: : Version v1.2.2
: : Written by Kiwi

@ECHO OFF
ECHO Setting backup location directory...
set "BACKUPLOCATION=%AppData%\\RocketDock Backup"
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Scanning for and creating directories...
IF NOT EXIST "%BACKUPLOCATION%" mkdir "%BACKUPLOCATION%"
IF NOT EXIST "%BACKUPLOCATION%\\Backup" mkdir "%BACKUPLOCATION%\\Backup"
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Detecting OS architecture...
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Setting OS architecture variables...
Set RegQry=HKLM\\Hardware\\Description\\System\\Centra lProcessor\\0

REG.exe Query %RegQry% > "%BACKUPLOCATION%\\CheckOS.txt"

Find /i "x86" < "%BACKUPLOCATION%\\CheckOS.txt" > "%BACKUPLOCATION%\\StringCheck.txt"
If %ERRORLEVEL% == 0 (
set "PROGRAMFILESDIR=Program Files"
set "OSARCHITECTURE=32-bit"
) ELSE (
set "PROGRAMFILESDIR=Program Files (x86)"
set "OSARCHITECTURE=64-bit"
)
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Setting program files directory...
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
cls

:start
ECHO RocketDock Backup and Restoration Utility
ECHO --------------------------------------------------
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Select a utility to launch.
ECHO 1) Backup utility
ECHO 2) Restoration utility
ECHO 3) Backup management utility
ECHO 4) About
ECHO 5) Exit
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO %x%


:1
ECHO.
ECHO RocketDock Backup Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating backup...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: Backing up RocketDock will overwrite any existing backups. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :yes)
if /i {%ANSWER%}=={yes} (goto :yes)
if /i {%ANSWER%}=={n} (goto :no)
if /i {%ANSWER%}=={no} (goto :no)

:no
ECHO Backup canceled.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:yes
ECHO Backing up files...
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Removing existing backup...
rmdir /s /q "%BACKUPLOCATION%\\Backup"
mkdir "%BACKUPLOCATION%\\Backup"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating backup...
XCOPY /s /e /q "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" "%BACKUPLOCATION%\\Backup"
ECHO Backing up registry...
IF EXIST "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg" echo Y|del "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg"
REG EXPORT "HKCU\\Software\\RocketDock" "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg" /y
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Backup completed.
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Your backup is located in %BACKUPLOCATION%\\Backup (Change this directory in the About menu)
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

: : Exit utility
:1_2
ECHO Clearing temporary storage...
echo Y|del "%BACKUPLOCATION%\\CheckOS.txt"
echo Y|del "%BACKUPLOCATION%\\StringCheck.txt"
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Exiting utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
exit

: : Return to main menu
:1_1
cls
GOTO start

: : Change directories
:1_3
cls
ECHO Directory Configuration Menu
ECHO.
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
set /p y=Enter the drive letter of your OS drive (i.e. C: D: E: etc) (Type "skip" to skip this step and leave default):
IF '%y%' == 'skip' goto :1_3_1
IF '%y%' == 'A:' set "HOMEDRIVE=A:"
IF '%y%' == 'B:' set "HOMEDRIVE=B:"
IF '%y%' == 'C:' set "HOMEDRIVE=C:"
IF '%y%' == 'D:' set "HOMEDRIVE=D:"
IF '%y%' == 'E:' set "HOMEDRIVE=E:"
IF '%y%' == 'F:' set "HOMEDRIVE=F:"
IF '%y%' == 'G:' set "HOMEDRIVE=G:"
IF '%y%' == 'H:' set "HOMEDRIVE=H:"
IF '%y%' == 'I:' set "HOMEDRIVE=I:"
IF '%y%' == 'J:' set "HOMEDRIVE=J:"
IF '%y%' == 'K:' set "HOMEDRIVE=K:"
IF '%y%' == 'L:' set "HOMEDRIVE=L:"
IF '%y%' == 'M:' set "HOMEDRIVE=M:"
IF '%y%' == 'N:' set "HOMEDRIVE=N:"
IF '%y%' == 'O:' set "HOMEDRIVE=O:"
IF '%y%' == 'P:' set "HOMEDRIVE=P:"
IF '%y%' == 'Q:' set "HOMEDRIVE=Q:"
IF '%y%' == 'R:' set "HOMEDRIVE=R:"
IF '%y%' == 'S:' set "HOMEDRIVE=S:"
IF '%y%' == 'T:' set "HOMEDRIVE=T:"
IF '%y%' == 'U:' set "HOMEDRIVE=U:"
IF '%y%' == 'V:' set "HOMEDRIVE=V:"
IF '%y%' == 'W:' set "HOMEDRIVE=W:"
IF '%y%' == 'X:' set "HOMEDRIVE=X:"
IF '%y%' == 'Y:' set "HOMEDRIVE=Y:"
IF '%y%' == 'Z:' set "HOMEDRIVE=Z:"
ECHO Setting OS drive...
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO OS drive letter set to %y%.
goto :1_3_1

:1_3_1
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
set /p z=Enter the name of your program files folder (i.e. Program Files (x86)) (Type "skip" to skip this step and leave default):
IF NOT "%z%"=="skip" set "PROGRAMFILESDIR=%z%"
IF "%z%"=="skip" goto :1_3_2
ECHO Setting program files directory...
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Program files directory set to %HOMEDRIVE%\\%PROGRAMFILESDIR%\\.

:1_3_2
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
set /p w=Enter the directory of your RocketDock backup location (i.e. %HOMEDRIVE%%HOMEPATH%\\Desktop\\) (Type "skip" to skip this step and leave default):
IF NOT "%w%"=="skip" set "BACKUPLOCATION=%w%"
IF "%w%"=="skip" goto :1_3_3
ECHO Setting backup location directory...
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Backup location set to %BACKUPLOCATION%.

:1_3_3
ECHO.
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Configuration is complete. Note that these settings are only valid for this session.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:2
ECHO.
ECHO RocketDock Restoration Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating restore...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Continue with RocketDock restore? (Y/N)
if /i {%ANSWER%}=={y} (goto :restoreyes)
if /i {%ANSWER%}=={yes} (goto :restoreyes)
if /i {%ANSWER%}=={n} (goto :restoreno)
if /i {%ANSWER%}=={no} (goto :restoreno)

:restoreno
ECHO Restore canceled.
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:restoreyes
ECHO Checking if RocketDock.exe is in use and terminating application if it is...
taskkill /f /im RocketDock.exe
ECHO Waiting...5 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...4 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...3 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...2 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...1 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Fixing directories...
rmdir /s /q "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock"
mkdir "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock"
ECHO Copying directories...
echo Y|XCOPY /s /e /q "%BACKUPLOCATION%\\Backup" "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock"
ECHO Merging registry backup...
regedit /s "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Launch RocketDock? (Y/N)
if /i {%ANSWER%}=={y} (goto :launchyes)
if /i {%ANSWER%}=={yes} (goto :launchyes)
if /i {%ANSWER%}=={n} (goto :launchno)
if /i {%ANSWER%}=={no} (goto :launchno)

:launchno
ECHO.
ECHO Restoration complete.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:launchyes
ECHO Launching RocketDock...
start /d "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" rocketdock.exe
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Process RocketDock.exe initialized
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Restoration complete.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:3
ECHO.
ECHO RocketDock Backup Management Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Select an action.
ECHO 1) Delete backup
ECHO 2) Create portable version of backup
ECHO 3) Restore backup from portable backup file
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO management_%x%

:management_1
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating deletion...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: This will permanently delete your RocketDock backup. This will also remove the temporary storage folder for this utility. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :deleteyes)
if /i {%ANSWER%}=={yes} (goto :deleteyes)
if /i {%ANSWER%}=={n} (goto :deleteno)
if /i {%ANSWER%}=={no} (goto :deleteno)

:deleteno
ECHO Backup deletion canceled.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:deleteyes
ECHO Deleting backups...
rmdir /s /q "%BACKUPLOCATION%"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p q=Enter a number:
IF '%q%' == '%q%' GOTO 1_%q%

:management_2
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating portable backup file...
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPLOCATION=Enter the directory in which you would like to store your portable backup file (i.e. %HOMEDRIVE%%HOMEPATH%\\Desktop):
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPSAVE=Enter the name you would like to store the portable backup file as (i.e. RocketDock Backup %date%):
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Checking if RocketDock.exe is in use and terminating application if it is...
taskkill /f /im RocketDock.exe
ECHO Waiting...5 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...4 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...3 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...2 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...1 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Backing up registry...
IF EXIST "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock\\Rocke tDock Registry Settings Backup.reg" echo Y|del "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock\\Rocke tDock Registry Settings Backup.reg"
REG EXPORT "HKCU\\Software\\RocketDock" "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock\\Rocke tDock Registry Settings Backup.reg" /y
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating portable backup...
ECHO Please wait. This may take a while.
CScript "%CD%\\zip.vbs" "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" "%PORTABLEBACKUPLOCATION%\emp.zip"
ECHO Configuring portable backup...
rename "%PORTABLEBACKUPLOCATION%\emp.zip" "%PORTABLEBACKUPSAVE%.backup"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Your portable backup file is located at %PORTABLEBACKUPLOCATION%\\%PORTABLEBACKUPSAVE%.bac kup
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
SET /P ANSWER=Launch RocketDock? (Y/N)
if /i {%ANSWER%}=={y} (goto :launchyes1)
if /i {%ANSWER%}=={yes} (goto :launchyes1)
if /i {%ANSWER%}=={n} (goto :launchno1)
if /i {%ANSWER%}=={no} (goto :launchno1)

:launchno1
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:launchyes1
ECHO Launching RocketDock...
start /d "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" rocketdock.exe
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Process RocketDock.exe initialized
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p v=Enter a number:
IF '%v%' == '%v%' GOTO 1_%v%

:management_3
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Restoring full backup from portable backup file...
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPLOCATION1=Enter the directory in which your portable backup is stored (i.e. %HOMEDRIVE%%HOMEPATH%\\Desktop):
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPSAVE1=Enter the name of your portable backup file (i.e. RocketDock Backup %date%) (You must EXCLUDE .backup extension):
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: This will overwrite any existing backups made with the backup utility. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :managementyes)
if /i {%ANSWER%}=={yes} (goto :managementyes)
if /i {%ANSWER%}=={n} (goto :managementno)
if /i {%ANSWER%}=={no} (goto :managementno)

:managementno
ECHO Portable backup file restore canceled.
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p t=Enter a number:
IF '%t%' == '%x%' GOTO 1_%t%

:managementyes
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Configuring portable backup file...
rename "%PORTABLEBACKUPLOCATION1%\\%PORTABLEBACKUPSAVE1%. backup" "temp.zip"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Restoring portable backup file...
ECHO Please wait. This may take a while.
CScript "%CD%\\unzip.vbs" "%PORTABLEBACKUPLOCATION1%\emp.zip" "%BACKUPLOCATION%\\Backup"
ECHO Configuring portable backup file...
rename "%PORTABLEBACKUPLOCATION1%\emp.zip" "%PORTABLEBACKUPSAVE1%.backup"
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Your portable backup file has been restored to %BACKUPLOCATION%\\Backup
ECHO Restore your backup using the restore utility.
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program
set /p k=Enter a number:
IF '%k%' == '%k%' GOTO 1_%k%

:4
cls
ECHO About RocketDock Backup and Restoration Utility
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Written by Kiwi
ECHO Version: v1.2.2
ECHO Last updated 7/27/2011
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO The following are automatically detected variables:
ver | findstr /i "5\\.0\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows 2000 (%COMPUTERNAME%)
ver | findstr /i "5\\.1\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows XP (%COMPUTERNAME%)
ver | findstr /i "5\\.2\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows Server 2003 (%COMPUTERNAME%)
ver | findstr /i "6\\.0\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows Vista (%COMPUTERNAME%)
ver | findstr /i "6\\.1\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows 7 (%COMPUTERNAME%)
ECHO Your OS drive is %HOMEDRIVE%
ECHO Your OS architecture is %OSARCHITECTURE%
ECHO Your program files directory is %HOMEDRIVE%\\%PROGRAMFILESDIR%
ECHO Your RocketDock main directory is %HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock
ECHO Your RocketDock backup directory is %BACKUPLOCATION%
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu, enter 2 to exit the program, or enter 3 to modify the directories reported above.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:5
ECHO Clearing temporary storage...
echo Y|del "%BACKUPLOCATION%\\CheckOS.txt"
echo Y|del "%BACKUPLOCATION%\\StringCheck.txt"
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Exiting utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
exit
post #5 of 8
Thread Starter 
Excellent, no one cares.
post #6 of 8
Quote:
Originally Posted by kiwiasian View Post
Excellent, no one cares.
Doh! No, I just haven't had this problem (yet). It's good to know that your solution is there if it does arise, though. Also, that's a nice bit of batch scripting you've got there. Ever thought of becoming a developer?
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
SpaceHeater v3
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II X6 1100T BE 4.113GHz Gigabyte GA-890FXA-UD5 (Rev3.1) PowerColor HD6950 2GB + MSI GTX 460 Cyclone HyperX Genesis DDR3 (4GBx2) 1713MHz 
Hard DriveOSMonitorKeyboard
Crucial m4 64GB | WD Blk 1TB | Barracuda 2TB RAID0 Win7 Ultimate x64 / Ubuntu 10.10 x86_64 27" Planar 1080p + Dell 1901FP in portrait Das Keyboard Model S Professional 
PowerCaseMouse
CoolerMaster 800W 80+ Gold CoolerMaster HAF 912 Logitech M570 Trackball 
  hide details  
Reply
post #7 of 8
Thread Starter 
Quote:
Originally Posted by tjwurzburger View Post
Doh! No, I just haven't had this problem (yet). It's good to know that your solution is there if it does arise, though. Also, that's a nice bit of batch scripting you've got there. Ever thought of becoming a developer?
Nope, I have no plans at all to become a developer. There is a chance though.

Thanks though.
post #8 of 8
Thread Starter 
Update 7/31/2011
v1.2.4

Tons of bug fixes. A lot of improvement was done on the portable backup creation utility. Improved compatibility with 32-bit operating systems.


: : RocketDock Backup and Restoration Utility
: : Version v1.2.4
: : Written by Kiwi

@ECHO OFF
ECHO Setting backup location directory...
set "BACKUPLOCATION=%AppData%\\RocketDock Backup"
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Scanning for and creating directories...
IF NOT EXIST "%BACKUPLOCATION%" mkdir "%BACKUPLOCATION%"
IF NOT EXIST "%BACKUPLOCATION%\\Backup" mkdir "%BACKUPLOCATION%\\Backup"
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Detecting OS architecture...
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Setting OS architecture variables...
Set RegQry=HKLM\\Hardware\\Description\\System\\Centra lProcessor\\0

REG.exe Query %RegQry% > "%BACKUPLOCATION%\\CheckOS.txt"

Find /i "x86" < "%BACKUPLOCATION%\\CheckOS.txt" > "%BACKUPLOCATION%\\StringCheck.txt"
If %ERRORLEVEL% == 0 (
set "PROGRAMFILESDIR=Program Files"
set "OSARCHITECTURE=32-bit"
) ELSE (
set "PROGRAMFILESDIR=Program Files (x86)"
set "OSARCHITECTURE=64-bit"
)
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Setting program files directory...
PING 1.1.1.1 -n 1 -w 300 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
cls

:start
ECHO RocketDock Backup and Restoration Utility
ECHO --------------------------------------------------
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Select a utility to launch.
ECHO 1) Backup utility
ECHO 2) Restoration utility
ECHO 3) Backup management utility
ECHO 4) About
ECHO 5) Exit
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO %x%


:1
ECHO.
ECHO RocketDock Backup Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating backup...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: Backing up RocketDock will overwrite any existing backups. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :yes)
if /i {%ANSWER%}=={yes} (goto :yes)
if /i {%ANSWER%}=={n} (goto :no)
if /i {%ANSWER%}=={no} (goto :no)

:no
ECHO Backup canceled.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:yes
ECHO Backing up files...
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Removing existing backup...
rmdir /s /q "%BACKUPLOCATION%\\Backup"
mkdir "%BACKUPLOCATION%\\Backup"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating backup...
XCOPY /s /e /q "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" "%BACKUPLOCATION%\\Backup"
ECHO Backing up registry...
IF EXIST "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg" echo Y|del "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg"
REG EXPORT "HKCU\\Software\\RocketDock" "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg" /y
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Backup completed.
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Your backup is located in %BACKUPLOCATION%\\Backup (Change this directory in the About menu)
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

: : Exit utility
:1_2
ECHO Clearing temporary storage...
echo Y|del "%AppData%\\RocketDock Backup\\CheckOS.txt"
echo Y|del "%AppData%\\RocketDock Backup\\StringCheck.txt"
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Exiting utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
exit

: : Return to main menu
:1_1
cls
GOTO start

: : Change directories
:1_3
cls
ECHO Directory Configuration Menu
ECHO.
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
set /p y=Enter the drive letter of your OS drive (i.e. C: D: E: etc) (Type "skip" to skip this step and leave default):
IF '%y%' == 'skip' goto :1_3_1
IF '%y%' == 'A:' set "HOMEDRIVE=A:"
IF '%y%' == 'B:' set "HOMEDRIVE=B:"
IF '%y%' == 'C:' set "HOMEDRIVE=C:"
IF '%y%' == 'D:' set "HOMEDRIVE=D:"
IF '%y%' == 'E:' set "HOMEDRIVE=E:"
IF '%y%' == 'F:' set "HOMEDRIVE=F:"
IF '%y%' == 'G:' set "HOMEDRIVE=G:"
IF '%y%' == 'H:' set "HOMEDRIVE=H:"
IF '%y%' == 'I:' set "HOMEDRIVE=I:"
IF '%y%' == 'J:' set "HOMEDRIVE=J:"
IF '%y%' == 'K:' set "HOMEDRIVE=K:"
IF '%y%' == 'L:' set "HOMEDRIVE=L:"
IF '%y%' == 'M:' set "HOMEDRIVE=M:"
IF '%y%' == 'N:' set "HOMEDRIVE=N:"
IF '%y%' == 'O:' set "HOMEDRIVE=O:"
IF '%y%' == 'P:' set "HOMEDRIVE=P:"
IF '%y%' == 'Q:' set "HOMEDRIVE=Q:"
IF '%y%' == 'R:' set "HOMEDRIVE=R:"
IF '%y%' == 'S:' set "HOMEDRIVE=S:"
IF '%y%' == 'T:' set "HOMEDRIVE=T:"
IF '%y%' == 'U:' set "HOMEDRIVE=U:"
IF '%y%' == 'V:' set "HOMEDRIVE=V:"
IF '%y%' == 'W:' set "HOMEDRIVE=W:"
IF '%y%' == 'X:' set "HOMEDRIVE=X:"
IF '%y%' == 'Y:' set "HOMEDRIVE=Y:"
IF '%y%' == 'Z:' set "HOMEDRIVE=Z:"
ECHO Setting OS drive...
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO OS drive letter set to %y%.
goto :1_3_1

:1_3_1
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
set /p z=Enter the name of your program files folder (i.e. %PROGRAMFILESDIR%) (Type "skip" to skip this step and leave default):
IF NOT "%z%"=="skip" set "PROGRAMFILESDIR=%z%"
IF "%z%"=="skip" goto :1_3_2
ECHO Setting program files directory...
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Program files directory set to %HOMEDRIVE%\\%PROGRAMFILESDIR%\\.

:1_3_2
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
set /p w=Enter the directory of your RocketDock backup location (i.e. %HOMEDRIVE%%HOMEPATH%\\Desktop\\) (Type "skip" to skip this step and leave default):
IF NOT "%w%"=="skip" set "BACKUPLOCATION=%w%"
IF "%w%"=="skip" goto :1_3_3
ECHO Setting backup location directory...
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Backup location set to %BACKUPLOCATION%.

:1_3_3
ECHO.
ECHO.
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Configuration is complete. Note that these settings are only valid for this session.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:2
ECHO.
ECHO RocketDock Restoration Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating restore...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Continue with RocketDock restore? (Y/N)
if /i {%ANSWER%}=={y} (goto :restoreyes)
if /i {%ANSWER%}=={yes} (goto :restoreyes)
if /i {%ANSWER%}=={n} (goto :restoreno)
if /i {%ANSWER%}=={no} (goto :restoreno)

:restoreno
ECHO Restore canceled.
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:restoreyes
ECHO Checking if RocketDock.exe is in use and terminating application if it is...
taskkill /f /im RocketDock.exe
ECHO Waiting...5 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...4 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...3 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...2 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...1 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Fixing directories...
rmdir /s /q "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock"
mkdir "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock"
ECHO Copying directories...
echo Y|XCOPY /s /e /q "%BACKUPLOCATION%\\Backup" "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock"
ECHO Merging registry backup...
regedit /s "%BACKUPLOCATION%\\Backup\\RocketDock Registry Settings Backup.reg"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=Launch RocketDock? (Y/N)
if /i {%ANSWER%}=={y} (goto :launchyes)
if /i {%ANSWER%}=={yes} (goto :launchyes)
if /i {%ANSWER%}=={n} (goto :launchno)
if /i {%ANSWER%}=={no} (goto :launchno)

:launchno
ECHO.
ECHO Restoration complete.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:launchyes
ECHO Launching RocketDock...
start /d "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" rocketdock.exe
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Process RocketDock.exe initialized
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Restoration complete.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:3
ECHO.
ECHO RocketDock Backup Management Utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Select an action.
ECHO 1) Delete backup
ECHO 2) Create portable version of backup
ECHO 3) Restore backup from portable backup file
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO management_%x%

:management_1
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Initiating deletion...
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: This will permanently delete your RocketDock backup. This will also remove the temporary storage folder for this utility. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :deleteyes)
if /i {%ANSWER%}=={yes} (goto :deleteyes)
if /i {%ANSWER%}=={n} (goto :deleteno)
if /i {%ANSWER%}=={no} (goto :deleteno)

:deleteno
ECHO Backup deletion canceled.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:deleteyes
ECHO Deleting backups...
rmdir /s /q "%BACKUPLOCATION%"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p q=Enter a number:
IF '%q%' == '%q%' GOTO 1_%q%

:management_2
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating portable backup file...
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPLOCATION=Enter the directory in which you would like to store your portable backup file (i.e. %HOMEDRIVE%%HOMEPATH%\\Desktop):
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPSAVE=Enter the name you would like to store the portable backup file as (i.e. RocketDockBackup%date%):
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Checking if RocketDock.exe is in use and terminating application if it is...
taskkill /f /im RocketDock.exe
ECHO Waiting...5 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...4 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...3 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...2 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Waiting...1 seconds
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Backing up registry...
IF EXIST "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock\\Rocke tDock Registry Settings Backup.reg" echo Y|del "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock\\Rocke tDock Registry Settings Backup.reg"
REG EXPORT "HKCU\\Software\\RocketDock" "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock\\Rocke tDock Registry Settings Backup.reg" /y
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Creating portable backup...
ECHO Please wait. This may take a while.
CScript "%CD%\\zip.vbs" "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" "%PORTABLEBACKUPLOCATION%\emp.zip"
ECHO Configuring portable backup...
rename "%PORTABLEBACKUPLOCATION%\emp.zip" "%PORTABLEBACKUPSAVE%.backup"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Completed.
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Your portable backup file is located at %PORTABLEBACKUPLOCATION%\\%PORTABLEBACKUPSAVE%.bac kup
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
SET /P ANSWER=Launch RocketDock? (Y/N)
if /i {%ANSWER%}=={y} (goto :launchyes1)
if /i {%ANSWER%}=={yes} (goto :launchyes1)
if /i {%ANSWER%}=={n} (goto :launchno1)
if /i {%ANSWER%}=={no} (goto :launchno1)

:launchno1
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:launchyes1
ECHO Launching RocketDock...
start /d "%HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock" rocketdock.exe
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Process RocketDock.exe initialized
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO.
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p v=Enter a number:
IF '%v%' == '%v%' GOTO 1_%v%

:management_3
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Restoring full backup from portable backup file...
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPLOCATION1=Enter the directory in which your portable backup is stored (i.e. %HOMEDRIVE%%HOMEPATH%\\Desktop):
PING 1.1.1.1 -n 1 -w 1000 >NUL
set /p PORTABLEBACKUPSAVE1=Enter the name of your portable backup file (i.e. RocketDock Backup %date%) (You must EXCLUDE .backup extension):
PING 1.1.1.1 -n 1 -w 1000 >NUL
SET /P ANSWER=WARNING: This will overwrite any existing backups made with the backup utility. Continue? (Y/N)
if /i {%ANSWER%}=={y} (goto :managementyes)
if /i {%ANSWER%}=={yes} (goto :managementyes)
if /i {%ANSWER%}=={n} (goto :managementno)
if /i {%ANSWER%}=={no} (goto :managementno)

:managementno
ECHO Portable backup file restore canceled.
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program.
set /p t=Enter a number:
IF '%t%' == '%x%' GOTO 1_%t%

:managementyes
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Overwriting previous backup...
rmdir /s /q "%BACKUPLOCATION%\\Backup"
mkdir "%BACKUPLOCATION%\\Backup"
ECHO Configuring portable backup file...
rename "%PORTABLEBACKUPLOCATION1%\\%PORTABLEBACKUPSAVE1%. backup" "temp.zip"
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Restoring portable backup file...
ECHO Please wait. This may take a while.
echo Y|CScript "%CD%\\unzip.vbs" "%PORTABLEBACKUPLOCATION1%\emp.zip" "%BACKUPLOCATION%\\Backup"
ECHO Configuring portable backup file...
rename "%PORTABLEBACKUPLOCATION1%\emp.zip" "%PORTABLEBACKUPSAVE1%.backup"
ECHO Completed.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Your portable backup file has been restored to %BACKUPLOCATION%\\Backup
ECHO Restore your backup using the restore utility.
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu or enter 2 to exit the program
set /p k=Enter a number:
IF '%k%' == '%k%' GOTO 1_%k%

:4
cls
ECHO About RocketDock Backup and Restoration Utility
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Written by Kiwi
ECHO Version: v1.2.4
ECHO Last updated 7/28/2011
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO The following are automatically detected variables:
ver | findstr /i "5\\.0\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows 2000 (%COMPUTERNAME%)
ver | findstr /i "5\\.1\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows XP (%COMPUTERNAME%)
ver | findstr /i "5\\.2\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows Server 2003 (%COMPUTERNAME%)
ver | findstr /i "6\\.0\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows Vista (%COMPUTERNAME%)
ver | findstr /i "6\\.1\\." > nul
IF %ERRORLEVEL% EQU 0 ECHO Your OS is Windows 7 (%COMPUTERNAME%)
ECHO Your OS drive is %HOMEDRIVE%
ECHO Your OS architecture is %OSARCHITECTURE%
ECHO Your program files directory is %HOMEDRIVE%\\%PROGRAMFILESDIR%
ECHO Your RocketDock main directory is %HOMEDRIVE%\\%PROGRAMFILESDIR%\\RocketDock
ECHO Your RocketDock backup directory is %BACKUPLOCATION%
ECHO.
PING 1.1.1.1 -n 1 -w 1000 >NUL
ECHO Enter 1 to return to the main menu, enter 2 to exit the program, or enter 3 to modify the directories reported above.
set /p x=Enter a number:
IF '%x%' == '%x%' GOTO 1_%x%

:5
ECHO Clearing temporary storage...
echo Y|del "%BACKUPLOCATION%\\CheckOS.txt"
echo Y|del "%BACKUPLOCATION%\\StringCheck.txt"
PING 1.1.1.1 -n 1 -w 500 >NUL
ECHO Exiting utility
PING 1.1.1.1 -n 1 -w 1000 >NUL
exit
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Other Software
Overclock.net › Forums › Software, Programming and Coding › Other Software › RocketDock Backup and Restore Utility!