回复 1# wxcute - @echo off
- if exist logfile (
- for %%i in (logfile) do (
- if "%%~ai"=="--a------" echo logfile is File!&del "%%i"&md logfile
- if "%%~ai"=="d--------" echo logfile is Folder!&rd /s /q "%%i"&cd.>logfile
- ) else (
- cd.>logfile
- )
- pause
复制代码
- dir /ad /b|findstr /i "^logfile">nul 2>nul&&echo logfile是目录&&rd /s /q logfile&&cd.>logfile||dir /a-d /b|findstr /i "^logfile">nul 2>nul&&echo logfile是文件&&del logfile&&md logfile||cd.>logfile
-
- pause
复制代码
- @echo off&setlocal enabledelayedexpansion
- if not exist logfile cd.>logfile
- for /f "skip=5 tokens=3" %%i in ('dir /tc logfile') do (
- set /a m+=1
- if !m!==1 (
- if "%%i"=="<DIR>" (
- echo logfile is Folder&rd /s /q "logfile"&cd.>logfile
- ) else (
- echo logfile is File!&del "logfile"&md logfile
- )
-
- )
- )
- pause
复制代码
|