Page 1 of 1

show files without extension

Posted: 25 Mar 2011 01:00
by dukdpk
Hi All

E:\MyProgramme contains number of files with different extensions. I want to show only all files with .exe , Please note that display file name only. Not display extension(i.e. .exe ). Please advice me how to write bat file for above requirement. I tried following one but display files with file extension.

DIR /B "E:\MyProgramme\*.exe" /O:d

Thank you

Re: show files without extension

Posted: 25 Mar 2011 06:32
by scienceguru1.bat
1)open the command prompt
2)type "H:" then hit enter
3)type "cd (folder name)" then hit enter
4)type "dir /b "*.exe""

Re: show files without extension

Posted: 25 Mar 2011 15:19
by aGerman
Process the DIR command in a FOR loop and use the ~n option to display only the file name.

Code: Select all

for /f "delims=" %%a in ('dir /a-d /b ""E:\MyProgramme\*.exe"') do echo %%~na

Regards
aGerman

Re: show files without extension

Posted: 28 Mar 2011 01:28
by dukdpk
hi aGerman

It works. thank you.

for /f "delims=" %%a in ('dir /a-d /b "E:\MyProgramme\*.exe"') do echo %%~na