Using a batch file to backup data to an external drive help
Posted: 25 Apr 2012 12:30
Hi everyone. I am hoping someone on this forum can assist me with this issue.
I have a batch file that we use at work to backup computers. Currently, all of the files associated with the batch file are meant to be put on an external drive. When the batch it run, it creates an additional dir on the external drive where it puts all of the files.
My problem is this. We want to be able to run the batch file from the main drive (C:\) and have it backup to the external drive without hard coding the external drive letter. Can anyone explain to me how to make it prompt for the drive where you want the backup folder to be created and the data moved to?
Here is the first part of my backup batch file:
REM Data Transfer Tool Ver 2.0.0
@echo off
mode con cols=140
mode con lines=400
cls
color 0A
echo BACKUP UTILITY
echo.
echo Machine Name: %COMPUTERNAME% User Name: %USERNAME%
echo.
echo Ready to BACKUP laptop data (Press [CTRL] C to Abort)...
echo.
cd\
pause
echo.
echo START TIME: %TIME%
echo.
if exist UserData\RestoreLog.txt erase UserData\RestoreLog.txt
if exist UserData\BackupLog.txt erase UserData\BackupLog.txt
echo Creating a restore point if Windows Scripting Host Security Settings Allows...
echo.
BIN\CreateRestorePoint.vbs
if exist UserData\%USERNAME%. (rd UserData\%USERNAME% /s/q)
mkdir UserData\%USERNAME%
I hope that makes sense. Thanks in advance for any help or suggestions.
Tripp
I have a batch file that we use at work to backup computers. Currently, all of the files associated with the batch file are meant to be put on an external drive. When the batch it run, it creates an additional dir on the external drive where it puts all of the files.
My problem is this. We want to be able to run the batch file from the main drive (C:\) and have it backup to the external drive without hard coding the external drive letter. Can anyone explain to me how to make it prompt for the drive where you want the backup folder to be created and the data moved to?
Here is the first part of my backup batch file:
REM Data Transfer Tool Ver 2.0.0
@echo off
mode con cols=140
mode con lines=400
cls
color 0A
echo BACKUP UTILITY
echo.
echo Machine Name: %COMPUTERNAME% User Name: %USERNAME%
echo.
echo Ready to BACKUP laptop data (Press [CTRL] C to Abort)...
echo.
cd\
pause
echo.
echo START TIME: %TIME%
echo.
if exist UserData\RestoreLog.txt erase UserData\RestoreLog.txt
if exist UserData\BackupLog.txt erase UserData\BackupLog.txt
echo Creating a restore point if Windows Scripting Host Security Settings Allows...
echo.
BIN\CreateRestorePoint.vbs
if exist UserData\%USERNAME%. (rd UserData\%USERNAME% /s/q)
mkdir UserData\%USERNAME%
I hope that makes sense. Thanks in advance for any help or suggestions.
Tripp