USB Backup with voice notification.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Hemlok
Posts: 10
Joined: 17 Nov 2019 15:32

USB Backup with voice notification.

#1 Post by Hemlok » 18 Nov 2019 10:29

I hope someone might find this version I chopped up useful. Its just a USB copy script created by someone else, with the voice function wrapped in. It makes for a nice backup utility for long backup jobs where I turn my speakers up loud and when she says "The backup process is complete! Press any key to exit" I know its done . No checking the PC over and over. I have large USB drives so this was useful in helping me avoid baby sitting my backup jobs. You can obviously change it to say whatever.


Enjoy.

-Hemlok

Code: Select all

:::::::::::::::::::::::::::::::::::
:: USB Backup With Voice V1.0     :
::                                :
::                                :
::                                :
:::::::::::::::::::::::::::::::::::
@Echo off
color 0f
Title USB Backup V1.0


:: variables


set drive=G:\Backup\Flash Drive <--------***Change to your path***


set backupcmd=xcopy /s /c /d /e /h /i /r /y

::Time and date

set "CURRDATE=%DATE%" & set "CURRTIME=%TIME%"
set "HOUR=%CURRTIME:~,2%"
if "%CURRTIME:~-2%" == "PM" if %HOUR% lss 12 set /A "HOUR+=12"
if "%CURRTIME:~-2%" == "AM" if %HOUR% equ 12 set /A "HOUR-=12"
if not "%CURRDATE%" == "%DATE%" if %CURRTIME:~0,2% equ 0 set "CURRDATE=%DATE%"
set "HOUR=0%HOUR%"

@echo off
color 0a
set "spk=Hello Administrator! Todays date is %DATE%. Starting USB backup now. I will notify you when the backup has completed.."
call :speak spk

:begin
set "spk="
set /p "spk=Speak: "
if not defined spk exit
set "spk=%spk:"=%"
call :speak spk
goto begin

:speak
setlocal enableDelayedExpansion
mshta "javascript:new ActiveXObject("SAPI.SpVoice").Speak('!%~1!');close();"
endlocal
cls
 


echo ### Backing up Flash Drive...


set hour=%time:~0,2%


if "%hour:~0,1%"==" " set hour=0%time:~1,1%


set folder=%date:~10,4%_%date:~4,2%_%date:~7,2%_%hour%_%time:~3,2%


%backupcmd% "H:\" "G:\Backups\Flash Drive\%folder%"      <--------***Change to your path***
endlocal
cls

@echo off
color 0a
set "spk=The backup process is complete! Press any key to exit."
call :speak spk

:begin
set "spk="
set /p "spk=Speak: "
if not defined spk exit
set "spk=%spk:"=%"
call :speak spk
goto begin

:speak
setlocal enableDelayedExpansion
mshta "javascript:new ActiveXObject("SAPI.SpVoice").Speak('!%~1!');close();"
endlocal
cls


@pause
exit

Post Reply