Wednesday, 15 April 2015

Windows batch script to determine last folder in list of paths -


I would like to read the list of paths from a file and every time I set the last folder I found, failed, but Read different threads of handling nested for loops and variable extension without success. I do not get the "last folder" Any problem here? External File (paths.txt):

  C: \ FirstFloulder \ Next Folder \ Last Folder C: \ Somewhere \ deep \ Finally C: \ Windows Batch Script:  
  @echo OFF setLocal EnableDelayedExpansion for / F "tokens = * eol = #" %% f in (% cd%)  
\ Paths.txt) (get the new path from the echo file: %% f set mydir = %% f set m =% mydir: \ =;% Call: GET_SYMLINK %% M) Disable setLocal Extended Extension: eof: for GET_SYMLINK / F "token = * deals =" %% i Call IN (% 1): LAST_FOLDER %% I goto: eof: LAST_FOLDER if "% 1" == "" (echo last fo Status:% LAST% Goto: eof) Set LAST =% 1 SHIFT Goto: LAST_FOLDER

< P> I'm afraid you are not clear what results you want, but if it is:

  The last falter is finally Temp  

. So got this batch file:

  @echo for more information, for ? Type  and read the details about it. "For variable modifier". 

If the path can contain spaces, then include the "delims =" option like this:

 for  / f "delims =" %% one (Paths.txt) in what echo %% ~ Na  

No comments:

Post a Comment