Originally posted by willsort at 2006-5-25 22:30:
Re namejm:
set _i=
set source=
set /p source= 请输入要备份文件的路径:
for %%s in (%source%) do set /a _i+=1
if "%_i%"=="1" for %%p in (%source%) do set source=%%~p
:: 以上两句为判断%source%中是否存在引号,有则剔除
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
当把程序放在带空格的目录下执行时,当输入的路径为当前盘符+冒号的时候,并不能禁止全盘复制.而放到不带空格的目录下执行,或者是输入的路径为任意盘符+冒号+\的时候,则没问题,不知道是为什么.
[ Last edited by namejm on 2006-5-26 at 00:12 ]

精华I