Question : Batch File: String manipulation

Hi there,

I need to replace a the word "SAISON" from a text file to the word "PERIOD+".

SCRIPT TO FIX:

@echo off
setlocal enabledelayedexpansion

FOR "delims=" %%A in (%File_LOG_Mirror%) do (
      ECHO !%%A:SAISON=PERIOD^+!>>%File_LOG_Mirror_TEMP%
      DEL %File_LOG_Mirror%
      REN %File_LOG_Mirror_TEMP% %File_LOG_Mirror%
)

exit


Thanks,
Rene

Answer : Batch File: String manipulation

Ah yes, that pesky bracket was in the wrong place!  Just to be clear it should look like this.

@echo off
setlocal enabledelayedexpansion

set File_LOG_Mirror=EE26415780.txt

FOR /F "usebackq delims=" %%A in ("%File_LOG_Mirror%") do (
    set Line=%%A
    ECHO !Line:SAISON=PERIOD^+!>>"%File_LOG_Mirror%._temp"
)
DEL "%File_LOG_Mirror%"
REN "%File_LOG_Mirror%._temp" "%File_LOG_Mirror%"

exit /b

~bp
Random Solutions  
 
programming4us programming4us