请教:如何用批处理判断某一扇区为空闲扇区?
比如我用软件读取39扇区后,得到的文件为039.txt,格式如下:
--------------
Disk 0 Absolute Sector 39
00000004E00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
。。。。。
略去
------------------
我用的批处理如下,麻烦各位给看看,哪里除了问题。
----------
rem @echo off
if exist %temp%\039.txt del %temp%\039.txt >nul
diskrw 0 39 1 /l >%temp%\039.txt
For /f "tokens=1-2 delims=:" %%i In ('type %temp%\039.txt ^| find ":"') do (
set sector=%%j
echo sector is "%sector%"
pause
if not "%sector%"==" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " goto sector_2c
)
:sector_2d
echo 39扇区为空闲扇区。
echo.
pause
goto sector_2b
:sector_2c
echo 39扇区不是空闲扇区。
echo.
pause
:sector_2b
[ Last edited by lianjiang2004 on 2007-6-4 at 05:00 PM ]
比如我用软件读取39扇区后,得到的文件为039.txt,格式如下:
--------------
Disk 0 Absolute Sector 39
00000004E00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000004E90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
。。。。。
略去
------------------
我用的批处理如下,麻烦各位给看看,哪里除了问题。
----------
rem @echo off
if exist %temp%\039.txt del %temp%\039.txt >nul
diskrw 0 39 1 /l >%temp%\039.txt
For /f "tokens=1-2 delims=:" %%i In ('type %temp%\039.txt ^| find ":"') do (
set sector=%%j
echo sector is "%sector%"
pause
if not "%sector%"==" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " goto sector_2c
)
:sector_2d
echo 39扇区为空闲扇区。
echo.
pause
goto sector_2b
:sector_2c
echo 39扇区不是空闲扇区。
echo.
pause
:sector_2b
[ Last edited by lianjiang2004 on 2007-6-4 at 05:00 PM ]
