-2
set PATTERNDIR=..\patterns\
set CMODEL= .\fcb.exe
FOR /R %PATTERNDIR% %%b IN (*.iq) DO (

  if exist %%b (
    %CMODEL% -i %%~dpnb.iq -o c_ref.out -p %%~dpnb.par 
    fc /b %%~dpnb.out c_ref.out >> cmp_c_ref.txt
  )  
)

Here %%b contains C:\Users\karthiks\Documents\2G\fcb\working\patterns\FCB_SPUR_original\TC_202\FCB _RA130_CO_900.iq I want to extract FCB_RA130_CO_900.iq

Can you please help me out

Magoo
  • 77,302
  • 8
  • 62
  • 84
Karthik S
  • 1
  • 1
  • possible duplicate of [Batch Extract path and filename from a variable](http://stackoverflow.com/questions/15567809/batch-extract-path-and-filename-from-a-variable) – Jauch Dec 31 '14 at 11:13
  • 1
    You should do a little search on internet first. The first entry for "bat extract name from path" on DuckDuck returned as first link another answer on Stack that address this doubt. :) http://stackoverflow.com/questions/15567809/batch-extract-path-and-filename-from-a-variable – Jauch Dec 31 '14 at 11:15
  • For your information: http://stackoverflow.com/help/how-to-ask – Jauch Dec 31 '14 at 11:16

1 Answers1

0
echo %%~nxb

should show you the name and extension of the filename in %%b. You don't say what you want to do with that name (and you already know the extension, and the fact that it exists).

see

for /?

from the prompt for documentation.

Magoo
  • 77,302
  • 8
  • 62
  • 84