![]() ![]() :: %%~fa-%%~b-%%~c is the same to drive:\path\name_folder :: below to the value for the _dir variable: Set "_dir=%%~fa-%%~b-%%~c" :: if _dir variable was not removed, set the string Set "_dir=" Set "_dir=" you do not need to add all known folder names to any if conditions in your bat/ cmd file.ġ) Use a for /f loop to list all folders with the layout target delimited by - and using the 1-2-3 tokens, and %%~a-%%~b-%%~c has become the same for your folder name layout SDF543-bbb-X0001 for /f tokens^=1-3delims^=^- %%a in ('dir /on/b/a:d *-*-*')do If not "!_dir!" = "" move /y "%%~fa-%%~b-%%~c" "!_dir!"įor your fifty or more directories, with a predictable name layout, this bat/cmd code can automate the task, so that no editing is necessary. This command can be used to rename files or directories on all Windows OS editions i.e Windows 2000, XP, Vista and Windows off
0 Comments
Leave a Reply. |