filenames - Get the file name from a full or relative path knowing that this one is not a parameter of the batch -


when file, along relative path or full path..., given parameter of batch, know how expand %1 file name

    %~n1  

it's quite easy!

nevertheless, want name of file relative/full path right handled inside batch.

please @ code. i'd expand %%x (which relative path in case) take account file name. please have idea? thanks

 @echo off  setlocal enabledelayedexpansion  set currdir=%cd%  /f "tokens=*" %%x in (lists.out) (  echo %%x  set filetxt=%%x) 

here's example "lists.out" file different files built-in relative paths. "lists.out" can made of

   temp\my file1_x    temp\my file2_x    ............... 

...  echo %%~nx  set filetxt=%%~nx) 

should cure problem.

or use ~nxx if want extension too.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -