Referring to What is the best way to do a substring in a batch file? I think the below should work.
FOR %%f IN (*.wav) DO CALL :runthis "%%f"
rem del temp.wav tmpfile
GOTO :EOF
:runthis
set "outdir=%~p1\output\"
copy "%~1" "%outdir%%~1"
The last command is supposed to dosomthing to all .wav files in current directory and output to existing sub-directory "output" keeping the original filename. Any idea where I'm going wrong?
Update1: Thanks, fixed the syntax. I didn't notice that %pI expands I to path only, didn't read carefully. Now what's wrong is that it's expanded with the "s
dosomething "11.wav" "\Users\t4\Desktop\Airlines\WavRepeaters\\outdir\"11.wav""
It should be something like::
dosomething "11.wav" c:\Users\t4\Desktop\Airlines\WavRepeaters\outdir\11.wav
Update2: %~dp1 - expands %1 to a drive letter and path only, without the quotations!