Windows 95/98/batch filenames

Advertisement


Question
QUESTION: Kevin,
I will post the previous response from a long time ago that worked great for me except I received too much info with the file names.  I only want the file name please tell me how to eliminate everything else in Notepad.  I'm Vista but this worked.  Below is the original answer:
Thanks for helping,
Tina

Hi Sebastian, all you need to do is go into DOS and do this.  But to make your life simple, I will create a batch file for you.  All you have to do is open up Notepad and copy and paste the following into it:

dir > filenames.txt
close

Then save the above as "filenames.bat" WITH the quotes.  You must include the quotes.  Save it to your Desktop or some other folder.  Now COPY filenames.bat to any one of the folders that you want to show the filenames.  So if you want to see the filenames in a folder called Downloads and another called Pictures, make a copy to both.  Not a shortcut, but a full copy.

When you have copied that file to the folder, just double click on filenames.bat and it should run automatically.  Now look in the same folder for a file called filenames.txt and open it.  It should have the list of filenames and other information.  There are a lot of ways to display how you want it in Notepad.  If you don't want all the information, like the file size, etc, post me a followup on what you want and I will get back to you.

Hope that helps.

Kevin.

ANSWER: Hi Tina, give the following a try:

dir /b > filenames.txt
close

Kevin.
Kevin's Resource Center - http://www.greyknight17.com
KRC Forum - http://www.greyknight17.com/bb

---------- FOLLOW-UP ----------

QUESTION: Kevin,
That worked great and such a quick response!  Can I also eliminate the file extension?
Thanks,
Tina

Answer
Hi Tina, try the following:

@echo off
setlocal
set List=C:\*.*
for /f "delims=" %%a in ('dir /b "%List%"') do echo %%~na >> filenames.txt

Replace the following line:

set List=C:\*.*

With the path you want. For example, c:\myfolder\*.*

Once you double click on it, it will create a file called filenames.txt. Feel free to change that name in the script if you want.

Kevin.
Kevin's Resource Center - http://www.greyknight17.com
KRC Forum - http://www.greyknight17.com/bb

Windows 95/98

All Answers


Answers by Expert:


Ask Experts

Volunteer


Kevin

Expertise

I`m familiar with Windows 95/98/XP problems and will try my best to assist you. Feel free to ask any software or hardware related questions.

Experience

I started using computers over 10 years ago and have grown to both love and hate it to say the least. I have studied computer programming and graduated with a bachelor's degree in computer science.

Education/Credentials
Bachelors in computer information science

©2012 About.com, a part of The New York Times Company. All rights reserved.