Originally posted by willsort at 2006-5-25 22:30:
Re namejm:
set _i=
set source=
set /p source= Please enter the path of the file to be backed up:
for %%s in (%source%) do set /a _i+=1
if "%_i%"=="1" for %%p in (%source%) do set source=%%~p
:: The above two sentences are to judge whether there are quotes in %source%, and if so, remove them
if "%source%"=="" goto input_source
if "%source%"=="0" goto :eof
if "%source%"=="1" goto backup_task
if not exist "%source%" goto source_noexist
for %%p in ("%source%") do if "%%~fp"=="%%~dp\" goto forbid
goto input_destination
When the program is executed in a directory with spaces, when the entered path is current drive letter + colon, it cannot prevent full disk copying. But when it is executed in a directory without spaces, or when the entered path is any drive letter + colon + \, there is no problem. I don't know why.
[ Last edited by namejm on 2006-5-26 at 00:12 ]

DigestI