for loop - Finding a certain file inside each directory in a set of directories using batch? -
This is my script. In this case I am trying to do the last file in the directory (when sorting alphabetically). Whenever I run it, the final file is given at every frequency in the 6th folder. What is wrong with this script? This works like this: Put it in your working directory and run it. $ / = $% = ~% F% for Edit: Make your code work For: @echo closed cd folder1 \ folder 2 for / d %% g (*) (echo %% g for CD %% g / f %% f ('/ B / ad / on ') Do (final = %% set up)% dcho% last% cd .. pause) cd .. cd ..
@echo off setlocal EnableDelayedExpansion for / ($ Dir / s / b / ad / on "%% a" '') % ~ XF "Echo of the last %% one! $ Is the last!) Echo finished ... Pause
@echo offlocal for EnableDelayedExpansion (*) in D %% G (resonance %% g CD %% G \ for / f "delims =" %% F in ( 'Dir / b) / Ad / on') Do (set to last = %%) Echo! Last! Cd .. pause) cd .. cd ..
Comments
Post a Comment