Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The windows %%f returns the full name of the file as 'filename.ext'

e.g.

for /r %%f in (*.wav) do echo %%f

Is there a way to extract the filename without the extension from %%f?

share|improve this question
up vote 4 down vote accepted

Change echo %%f to echo %%~nf.

~n tells the cmd to expand f to equal only the filename, minus the extension.

share|improve this answer
    
Thanks mate! May I be so bold as to enquire how you acquired that little tid-bit? – Everyone Jul 17 '11 at 16:25
1  
From the horse's mouth: technet.microsoft.com/en-us/library/bb490909.aspx. Generally, anything Product related is going to be under technet.microsoft.com. Anything programming related is going to be under msdn.microsoft.com (Microsoft Developer's network). – surfasb Jul 17 '11 at 20:07
    
Very useful (+: Thank you! – Everyone Jul 17 '11 at 20:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .