How to list files in a folder with input?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
EpicBlargh
Posts: 3
Joined: 11 Sep 2012 15:09

How to list files in a folder with input?

#1 Post by EpicBlargh » 11 Sep 2012 15:11

I want to automatically display all files in a folder, but I need it to be with input so I can respond with a file name. Any ideas? Help would greatly be appreciated.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: How to list files in a folder with input?

#2 Post by foxidrive » 11 Sep 2012 19:07

Can you describe what you need to do more thoroughly?

This should display the files in the current directory.

dir /b /a:-d

EpicBlargh
Posts: 3
Joined: 11 Sep 2012 15:09

Re: How to list files in a folder with input?

#3 Post by EpicBlargh » 11 Sep 2012 20:14

What I'm trying to do, is make a user input in a batch file. It automatically lists...

I just figured it out in my head. Well, with help from your line too.

Thank you :D

EpicBlargh
Posts: 3
Joined: 11 Sep 2012 15:09

Re: How to list files in a folder with input?

#4 Post by EpicBlargh » 11 Sep 2012 20:22

foxidrive wrote:Can you describe what you need to do more thoroughly?

This should display the files in the current directory.

dir /b /a:-d

Actually, how would I modify this to list folders in a different folder rather than the current one?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: How to list files in a folder with input?

#5 Post by foxidrive » 11 Sep 2012 21:47

Actually, how would I modify this to list folders in a different folder rather than the current one?[/quote]

Did you want to list folders or files? This lists files.

Code: Select all

@echo off
dir "%~1" /b /a:-d
pause


Launch it like this: dirlist.bat "c:\folder\files\"

or dirlist.bat d:\backup

or drag a folder onto the icon.

Post Reply