@echo off & title 生成Excel表格 By 依夢琴瑤
cd /d %~dp0
(for /d %%a in (*) do (
pushd "%%~a"
CD.>"%tmp%\CSV.LOG"
for /f "delims=" %%b in ("dir /a-d/b") do (
for /f "delims=" %%c in ("dir /a-d/b/o-n "*%%~xb"") do set /a "Fst=1%%~nc-10000"
set "Str=%%~xb"
call findstr /bei /c:"\"%%~a\",\"%%Fst%%\",\"%%Str:~1%%\"" "%tmp%\CSV.LOG" >NUL 2>NUL || (
(call echo "%%~a","%%Fst%%","%%Str:~1%%")>>"%tmp%\CSV.LOG"
)
popd
type "%tmp%\CSV.LOG"
))>"Excel表格記錄.xls"
pause
生成的Excel是csv格式的,因此開啟後表格間的間隔什麼的需要自己手動調整一下,然後另存為正常的xls格式。
@echo off & title 生成Excel表格 By 依夢琴瑤
cd /d %~dp0
(for /d %%a in (*) do (
pushd "%%~a"
CD.>"%tmp%\CSV.LOG"
for /f "delims=" %%b in ("dir /a-d/b") do (
for /f "delims=" %%c in ("dir /a-d/b/o-n "*%%~xb"") do set /a "Fst=1%%~nc-10000"
set "Str=%%~xb"
call findstr /bei /c:"\"%%~a\",\"%%Fst%%\",\"%%Str:~1%%\"" "%tmp%\CSV.LOG" >NUL 2>NUL || (
(call echo "%%~a","%%Fst%%","%%Str:~1%%")>>"%tmp%\CSV.LOG"
)
)
popd
type "%tmp%\CSV.LOG"
))>"Excel表格記錄.xls"
pause
生成的Excel是csv格式的,因此開啟後表格間的間隔什麼的需要自己手動調整一下,然後另存為正常的xls格式。