Quick edit to remove erroneous space Try this? (remove the %% and replace with % if running from the command line direct rather than a batch file)
For /f “tokens=5 delims= “ %%a in (‘dir ^| find “AL1030004”’) do set directory=%%a For /f “tokens=1,3,4 delims=_” %%a in (‘echo %Directory%’) do ren c:\%directory% %%a_OutProcessedABS_%%b_%%c From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Bambi J Saastad Sent: 04 November 2015 10:33 To: [email protected]<mailto:[email protected]> Subject: [NTSysADM] Rename Directories Hoping for some help with renaming directories I had hoped to just use the move command but I get syntax errors.... The directories are named in this manner AL1030004_502010109H_20151102_163916 I need to replace the middle 502010109H with OutProcessedABS so it would become AL1030004_OutProcessedABS_20151102_163916 I think I need to instead use a for loop, but I cannot get that syntax right either Any quick suggestions? Thx B? ----------------------------- Bambi Saastad office 952-402-7888 cell 612-963-1478
