LoginSignup
1
2

More than 5 years have passed since last update.

コマンドプロンプト フォルダ内のファイルをテキストファイルにかき出す方法

Posted at

スタートメニューの検索で「cmd.exe」と入力

以下のように入力しEnterキーを押します。(※フォルダ名はフルパスで入力するか、フォルダをコマンド画面にドラッグ )

Dir /b フォルダ名 > 出力ファイル名  ★/bを付ける と要約や日時、サイズなどを省略し直下のファイル・フォルダの名前のみ出力されます。

Dir /b /a-d フォルダ名 > 出力ファイル名 ★/a-dを付けるとサブフォルダ名は出力しません。(直下のファイル名のみ出力)

Dir /b /s フォルダ名 > 出力ファイル名 ★/sを付けるとフォルダ 、サブフォルダ内の全ファイル名をフルパスで出力します。

Dir /b /s /a-d フォルダ名 >出力ファイル名 ★全フォルダ内のファイル名をフルパスで出力します。

Dir /ad フォルダ名 >出力ファイル名 ★/ad はフォルダ名のみ出力します。
 
例:デスクトップの「Works」フォルダのファイル名一覧をC:\File.txtというテキストファイルに保存する場合は以下のように入力します。

Dir /b C:\Users\Name\Desktop\Works >C:\File.txt

1
2
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
1
2