LoginSignup
0
0

More than 1 year has passed since last update.

ディレクトリを検索するバッチ

Posted at

@echo off
setlocal EnableDelayedExpansion

REM ドライブレターを取得する
for /f "tokens=1" %%a in ('wmic logicaldisk get caption ^| findstr /r /c:"[A-Z]:"') do (
set "drive=%%a"
echo Processing !drive!...

REM ファイル名を作成する
set "filename=!drive!_dir.txt"

REM ディレクトリ構造をファイルに保存する
dir /s /b !drive!\ > "!filename!"
)

echo All drives have been processed.
pause

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0