# Solved: Copying filename without extension in DOS



## jaredlet (Jul 9, 2005)

Hey all I have been trying to get all the file names of a directory copied into notepad, but i cannot get them to display without their extensions. I have been trying 

dir /b

dir /b *.

dir /a-d *.

and similar commands but none seem to work. If anyone knows how to display all files in a directory with only the file name and no extension I would greatly appreciate it. Thanks!


----------



## jaredlet (Jul 9, 2005)

NM all I figured it out. I used a program called dirprinter which is a shareware app found here
http://www.programurl.com/software-d...wnloadnow.html

it can export a directory listing with only the file name.


----------



## devil_himself (Apr 7, 2007)

use this batch file

open notepad ..copy the code into notepad ..save the notepad as "dirlist.bat" with quotes .
move to the desired folder and double click to run


```
@echo off 
for /f "tokens=*" %%a in ('dir /b /a-d') do echo %%~na>>output.txt
```


----------



## jaredlet (Jul 9, 2005)

I would rather use your batch instead of installing shareware app for this simple task. Thanks a million!


----------

