Backup Batch file for Windows

@echo off

:: Compressing the Folder
7z a "C:\Backup.7z" "C:\Application"

:: Mounting the remote directory

net use x: \\192.168.0.1\d\Backup\ /user:username password

:: Copying backup file to remote directory
copy /Z /Y "C:\Backup.7z" "x:\Backup.7z"

:: Adding Timestamp

For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
rename "x:\Code\Users.7z" "Users-%mydate%%mytime%.7z"

:: Unmounting the remote directory
net use x: /delete

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !