rfancella Posted December 8, 2014 Posted December 8, 2014 Hello all, I have been approached by a couple people that have had problems with setting files becoming corrupt or missing. I wrote a small batch file a while back that copied all the settings from HyperSpin and HyperLaunch. I have been working on it to make it more robust, but still use the minimum amount of requirements. The only requirement is that robocopy.exe be in your paths. Robocopy is already on your machine if you have anything higher than Windows XP. For those that are running Windows XP, there is a link in the batch file where to get it. It will keep the six (6) newest backups. It backups the following directories and all the files in them: HyperSpin\Databases HyperSpin\Settings HyperLaunch\Data HyperLaunch\Lib HyperLaunch\Modules HyperLaunch\Profiles HyperLaunch\Settings HyperLaunch\HyperLaunchHQ\Notes HyperLaunch\HyperLaunchHQ\Plugins HyperLaunch\HyperLaunchHQ\Profiles HyperLaunch\HyperLaunchHQ\Settings The batch file must be run from your HyperSpin directory. The default directory for HyperLaunch is HyperSpin\HyperLaunch\. This can be changed when you run the script or you can change the default variable in the script. The default directory for the backup is HyperSpin\Backups\. This can only be changed by changing the variable in the batch file. There is also a variable called SkipPrompts. It is default to 'no'. If you change this to yes, it will use all the variable values in the script and run with no interaction. The script will backup all the files and close automatically. With SkipPrompts set to no, here are a couple screen shots: 1). When run, you will see a little info on what the script will do. 2). Hit a key and it asks you to confirm your HyperLaunch directory. If you hit Y for Yes, it jumps to Step 5. 3). If you hit N for No, it asks if you would like to enter a New path to HyperLaunch or Quit. 4). If you hit N for New Path, it asks you to enter the path to the HyperLaunch root directory. Once you enter it, it goes back to Step 2 to confirm. 5). The script then checks your HyperSpin and HyperLaunch path to see if they exist. If so, the backup starts. 6). When finished, you get a thank you and hit any key to close. There is no restore process and I don't think there should be. All the files are un-compressed and you can copy out any one or group of files. This does not backup any roms, media, executables, emulators or emulator settings. This script can be found on the FTP: /Upload Here/rfancella/Backup.zip Anyone who finds this useful, please let me know. Thanks, Ron The Script (Backup.cmd): @ECHO OFF SETLOCAL rem You can set the variables below. rem HLRoot is the path to your HyperLaunch directory. Be sure and add the trailing \ rem SkipPrompts set to yes uses the HLRoot variable below and starts the backup based on that. rem If you set SkipPrompts to no, it will echo the HLRoot below and ask if it is correct. rem If it is not correct, you can enter n (for new path) and enter the new path for HyperLaunch. rem rem This program will back all the files in: rem HyperSpin\Settings rem HyperSpin\Modules rem HyperLaunch\Settings rem HyperLaunch\Modules rem HyperLaunch\Profiles rem HyperLaunch\Data rem HyperLaunch\Lib rem HyperLaunch\HyperLaunchHQ\Notes rem HyperLaunch\HyperLaunchHQ\Plugins rem HyperLaunch\HyperLaunchHQ\Profiles rem HyperLaunch\HyperLaunchHQ\Settings rem variables SET HLRoot=HyperLaunch\ SET SkipPrompts=no SET BURoot=Backups\ for %%X in (robocopy.exe) do (set FOUND=%%~$PATH:X) if not defined FOUND ( echo. echo Robocopy not found in your path. echo. echo If you are running Windows XP, it can be installed here: echo https://www.microsoft.com/en-us/download/details.aspx?id=17657 echo. echo Please install robocopy. The script will now end. echo. pause goto :EOF ) if %SkipPrompts% == yes goto :CHKPATHS echo. echo This program will backup all the files in: echo HyperSpin\Settings echo HyperSpin\Modules echo HyperLaunch\Settings echo HyperLaunch\Modules echo HyperLaunch\Profiles echo HyperLaunch\Data echo HyperLaunch\Lib echo HyperLaunch\HyperLaunchHQ\Notes echo HyperLaunch\HyperLaunchHQ\Plugins echo HyperLaunch\HyperLaunchHQ\Profiles echo HyperLaunch\HyperLaunchHQ\Settings echo. echo This file needs to run from within your HyperSpin directory. echo. echo The default for HyperLaunch is in HyperSpin, but this can be echo changed when it's run. echo. echo The paths can all be set by editing the batch file. echo. echo You can also tell it to skip all this and just run using echo the defaults. (SkipPrompts=yes) echo. echo But first, we will check the paths. echo. pause cls :CHKPATHS if not exist hyperspin.exe goto :HSNot if not exist %HLRoot%hyperlaunch.exe goto :HLNot if %SkipPrompts% == yes goto :START :TOP echo. choice /m "Is '%HLRoot%' your HyperLaunch directory " If errorlevel 2 goto :PROOT If errorlevel 1 goto :START :PROOT cls echo. choice /c nq /m "Would you like to enter a New path, or Quit " If errorlevel 2 goto :EOF cls echo. echo This variable can be edited in the batch file. echo. echo Enter a new path below. Be sure and end with a \ echo. set /p HLRoot="HyperLaunch Root Directory: " cls if not exist %HLRoot%hyperlaunch.exe goto :HLNot goto :TOP :START cls echo. echo Please wait... if %SkipPrompts% == yes ( echo This screen will close when finished. ) echo. if exist %BURoot%HSBackup6\MyHSBackup.txt ( rmdir /s /q %BURoot%HSBackup6 Echo Backup 6 Deleted Echo. ) if exist %BURoot%HSBackup5\MyHSBackup.txt ( move %BURoot%HSBackup5 %BURoot%HSBackup6 Echo Moved Backup 5 to 6 Echo. ) if exist %BURoot%HSBackup4\MyHSBackup.txt ( move %BURoot%HSBackup4 %BURoot%HSBackup5 Echo Moved Backup 4 to 5 Echo. ) if exist %BURoot%HSBackup3\MyHSBackup.txt ( move %BURoot%HSBackup3 %BURoot%HSBackup4 Echo Moved Backup 3 to 4 Echo. ) if exist %BURoot%HSBackup2\MyHSBackup.txt ( move %BURoot%HSBackup2 %BURoot%HSBackup3 Echo Moved Backup 2 to 3 Echo. ) if exist %BURoot%HSBackup1\MyHSBackup.txt ( move %BURoot%HSBackup1 %BURoot%HSBackup2 Echo Moved Backup 1 to 2 Echo. ) mkdir %BURoot%HSBackup1 Echo Directory for Backup 1 created echo. echo. echo The backup process will now start... echo. echo. SET _source=Settings SET _dest=%BURoot%HSBackup1\Settings SET _options=/R:0 /W:0 /LOG:%BURoot%HSBackup1\MyHSBackup.txt /NFL /NDL :: /R:n :: number of Retries :: /W:n :: Wait time between retries :: /LOG :: Output log file :: /NFL :: No file logging :: /NDL :: No dir logging CALL :RUN Echo HS Settings Done SET _options=/R:0 /W:0 /LOG+:%BURoot%HSBackup1\MyHSBackup.txt /NFL /NDL :: /R:n :: number of Retries :: /W:n :: Wait time between retries :: /LOG :: Output log file :: /NFL :: No file logging :: /NDL :: No dir logging SET _source=Databases SET _dest=%BURoot%HSBackup1\Databases CALL :RUN Echo HS Databases Done SET _source=%HLRoot%Settings SET _dest=%BURoot%HSBackup1\HyperLaunch\Settings CALL :RUN Echo HL Settings Done SET _source=%HLRoot%Modules SET _dest=%BURoot%HSBackup1\HyperLaunch\Modules CALL :RUN Echo HL Modules Done SET _source=%HLRoot%Profiles SET _dest=%BURoot%HSBackup1\HyperLaunch\Profiles CALL :RUN Echo HL Profiles Done SET _source=%HLRoot%Data SET _dest=%BURoot%HSBackup1\HyperLaunch\Data CALL :RUN Echo HL Data Done SET _source=%HLRoot%Lib SET _dest=%BURoot%HSBackup1\HyperLaunch\Lib CALL :RUN Echo HL Lib Done SET _source=%HLRoot%HyperLaunchHQ\Notes SET _dest=%BURoot%HSBackup1\HyperLaunch\HyperLaunchHQ\Notes CALL :RUN Echo HLHQ Notes Done SET _source=%HLRoot%HyperLaunchHQ\Plugins SET _dest=%BURoot%HSBackup1\HyperLaunch\HyperLaunchHQ\Plugins CALL :RUN Echo HLHQ Plugins Done SET _source=%HLRoot%HyperLaunchHQ\Profiles SET _dest=%BURoot%HSBackup1\HyperLaunch\HyperLaunchHQ\Profiles CALL :RUN Echo HLHQ Profiles Done SET _source=%HLRoot%HyperLaunchHQ\Settings SET _dest=%BURoot%HSBackup1\HyperLaunch\HyperLaunchHQ\Settings CALL :RUN Echo HLHQ Settings Done if %SkipPrompts% == yes goto :EOF echo. echo. echo Thank you for using this backup script. echo. echo The script will now close. echo. pause GOTO :EOF :HLNot echo. echo HyperLaunch.exe does not exist in '%HLRoot%'. echo. pause goto :PROOT :HSNot echo. echo HyperSpin.exe does not exist here. echo. echo Please move this file into your HyperSpin directory and try again. echo. pause goto :EOF :RUN SET _what=/COPYALL /B /SEC /MIR :: /COPYALL :: COPY ALL file info :: /B :: copy files in Backup mode. :: /SEC :: copy files with SECurity :: /MIR :: MIRror a directory tree ROBOCOPY %_source% %_dest% %_what% %_options% :EOF Code Monkey and all around Command Line geek!If you like what someone has said or done for you, be sure and 'Thank' them. And if they changed your life, send them a Beer!
gigapig Posted December 9, 2014 Posted December 9, 2014 Thank you Ron, this will come in very handy for sure. I have a couple of general questions. You say "It will keep the six (6) newest backups" could you clarify that? Is the Robocopy keeping 6 backups or is the script doing it? For the ultra paranoid, I suppose this could be run on a schedule, perhaps with Task Manager? Cheers.
rfancella Posted December 9, 2014 Author Posted December 9, 2014 Thank you Ron, this will come in very handy for sure.I have a couple of general questions. You say "It will keep the six (6) newest backups" could you clarify that? Is the Robocopy keeping 6 backups or is the script doing it? For the ultra paranoid, I suppose this could be run on a schedule, perhaps with Task Manager? Cheers. Gig, Thank you. The script keeps the 6 newest sets. They are rotated by the script. When run it deletes backup 6 and then moves 5 to 6. Then moves backup 4 to 5, etc. It could be set to run, yes. The intent is to backup all your settings after you make changes to your HyperSpin or HyperLaunch setup. I thought having multiple backups would help because I often make more changes than one and may not check all the changes. This way I can compair multiple sets of files. Thanks, Ron Code Monkey and all around Command Line geek!If you like what someone has said or done for you, be sure and 'Thank' them. And if they changed your life, send them a Beer!
brolly Posted December 9, 2014 Posted December 9, 2014 Nice one Ron, this actually sounds like a good future feature for HLHQ
rfancella Posted December 9, 2014 Author Posted December 9, 2014 Nice one Ron, this actually sounds like a good future feature for HLHQ That would be sweet Brolly! At the very least, a "changed" log of sorts: {System Name} - {Tab}[ - {Sub-Tab}] - {Original Value} - {New Value} Or something like that?? Thanks, Ron Code Monkey and all around Command Line geek!If you like what someone has said or done for you, be sure and 'Thank' them. And if they changed your life, send them a Beer!
Iggy Posted December 9, 2014 Posted December 9, 2014 I know you are the cmd prompt master....however let me know if you want it converted to a simple vbscript with HTA frontend interface....unless you u know vbscript [sIGPIC][/sIGPIC]Sega Saturn Japanese Wheel Project: COMPLETE!! If you have FTP access, find my name and grab the set now!!!
Styphelus Posted December 10, 2014 Posted December 10, 2014 I know you are the cmd prompt master....however let me know if you want it converted to a simple vbscript with HTA frontend interface....unless you u know vbscript That would be nice!
brolly Posted December 10, 2014 Posted December 10, 2014 That would be sweet Brolly!At the very least, a "changed" log of sorts: {System Name} - {Tab}[ - {Sub-Tab}] - {Original Value} - {New Value} Or something like that?? That would require a lot more work than what's worth, your solution is more than good enough
Recommended Posts
Archived
This topic is now archived and is closed to further replies.