Backup
Posted: 12 Nov 2012 08:01
I have followed all the advice you guys gave me. But my program still doesn't work... so I have given up all hope. This is the piece of code I need help with:
Code: Select all
@echo off
title Backup
color 0a
setlocal enableDelayedExplansion
:varset
cls
set location=
set destination=
set agree=
echo Enter a location and destination or simply type save
echo to add and create paths to inherit from.
set /p location=Location of file/folder:
if /i "%location%"=="save" (
set save=location
goto save)
set /p destination=Destination to copy to:
if /i "%destination%"=="save" goto save
echo.
echo Location: %location%
echo Destination: %destination%
echo Agree?
set /p agree=(yes/no):
if /i "%agree%"=="no" goto varset
if not exist "%destination%\BackupMainDir" md "%destination%\BackupMainDir"
set checknum=1
:checkfunc
if exist "%destination%\BackupMainDir\Backup %checknum%" (
set /a checknum=%checknum% + 1
goto checkfunc) else (
md "%destination%\BackupMainDir\Backup %checknum%"
xcopy "%location%\*.*" "%destination%\BackupMainDir\Backup %checknum%" /s /h /e /k /f /c 2>nul
xcopy "%location%.*" "%destination%\BackupMainDir\Backup %checknum%" /s /h /e /k /f /c 2>nul
pause
goto :eof)
:save
cls
set stringload=
set new=
if exist "%appdata%\BackupSaves.txt" (
echo How many strings do you want to load?
set /p stringload=::
cd "%appdata%"
//PROBLEM STARTS HERE
<BackupSaves.txt (
for /l %%G in (0,1,!stringload!) do (
set /p _save%%G=)))
cls
echo Select a variable to inherit or type "new" to create a new list...
set _save
echo.
set /p select=::
if /i "%select%"=="new" (
echo.
set /p new=New Address:
cd %appdata%
if not exist "BackupSaves.txt" (
echo %new% > "BackupSaves.txt") else (
echo %new% >> "BackupSaves.txt")) else (
if "%save%"=="location" (
set location=%select%) else (
set destination=%select%))
goto varset