-4

I have a lot of files named like this

PYHT_YH01_G1_HM_9002-01_SFINP.rpt_20161027115330

Need to add QUAL_PX_PlanConnexion@:

QUAL_PX_PlanConnexion@PYHT_YH01_G1_HM_9002-01_SFINP.rpt.f07_20161027115330

How can I do that to over 1200 files fast and simple

Stephan
  • 53,940
  • 10
  • 58
  • 91
Paul l
  • 1

1 Answers1

1

just noticed, you also have a change in the extension part, which makes it a little bit more complicated:

@echo off
break> PYHT_YH01_G1_HM_9002-01_SFINP.rpt_20161027115330
dir
setlocal enabledelayedexpansion
for %%a in (*.rpt_*) do (
  set "ext=%%~xa"
  ren  "%%a" "QUAL_PX_PlanConnexion@%%~na!ext:_=.f07_!"
)
dir

see for /?, set /? and ren /? for details. Also read about delayed expansion.

Community
  • 1
  • 1
Stephan
  • 53,940
  • 10
  • 58
  • 91