Created
August 10, 2013 08:26
-
-
Save Ratstail91/6199591 to your computer and use it in GitHub Desktop.
My first personal utility "program". I used this to update changes to a USB I used to carry around with me. It requires that the USB in question has a copy of _this_ file on it, and the "backup" folder needs to exist, to prevent backing up the wrong USB. This also copies changes to the "master" version into the process as well. The "master" copy…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
ECHO USB Backup Utility designed by Kayne Ruse. | |
SET folder=USBBackup | |
ECHO Instructions | |
ECHO. | |
ECHO 1) There must be a folder called "%folder%" in this directory. | |
ECHO 2) The USB must have a copy of this file in it's root directory. | |
ECHO. | |
:getDrive | |
SET /P drive=Enter USB drive (one letter): | |
IF NOT EXIST %drive%:\%~nx0 GOTO getDrive | |
IF NOT EXIST %folder% GOTO getDrive | |
COPY %~nx0 %drive%:\%~nx0 > NUL | |
COPY %drive%:\%~nx0 %folder%\%~nx0 > NUL | |
ECHO. | |
ECHO Copy the %drive%: drive files? | |
SET /P choice= (y)es, (n)o, (s)hutdown or (r)estart: | |
ECHO. | |
IF NOT %choice%==y ( | |
IF NOT %choice%==s ( | |
IF NOT %choice%==r ( | |
GOTO end | |
) | |
) | |
) | |
XCOPY %drive%:\ %folder% /D /E /Y | |
IF %choice%==y GOTO end | |
IF %choice%==s ( | |
SHUTDOWN -s -f -t 30 | |
ECHO Shutdown in progress | |
) | |
IF %choice%==r ( | |
SHUTDOWN -r -f -t 10 | |
ECHO Restart in progress | |
) | |
:abort | |
SET /P abort=Enter (a) to abort: | |
IF %abort%==a ( | |
SHUTDOWN -a | |
GOTO end | |
) ELSE ( | |
GOTO abort | |
) | |
:END | |
ECHO. | |
ECHO Program ended | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment