Get Filename in DOS for loop

Posted by Murtaza RC on Stack Overflow See other posts from Stack Overflow or by Murtaza RC
Published on 2009-07-08T20:42:00Z Indexed on 2010/06/17 23:03 UTC
Read the original article Hit count: 332

Filed under:
|
|
|
|

I have the following For loop in a batch file:

for /R c:\test\src %%i IN (*.*) DO (
MOVE %%i C:\test\destination
ECHO %%i
exit
)

The result of the ECHO outputs the entire file path Ex: C:\Foldername\Filename I need to ECHO out only the Filename.Is there a specific command which would give me the filename ? Thanks !

© Stack Overflow or respective owner

Related posts about batch

Related posts about script