computing
  • 7

Solved How To Replace Comma With Space Using Batch Script

  • 7

Hi all,

I am very new to batch script.
I have many text files in the folder D\Folder\Data\Data
i want to replace all the comma in each text file with space.
Could some one please help me do this script

Share

1 Answer

  1. Here the script not tested and pay attention it removes all blank lines. If the blank lines have to bevretained a variant is needed.

    @echo off & setlocal EnableDelayedExpansion
    pushd D:\Folder\Data\Data
    for %%j in (*.txt) do for /F "tokens=* delims=" %%k  in ('type "%%j"') do (
      set row=%%k
      sei row=!row:,= !
      echo.!row!
    ) >>  "%%~nj.t$t"
    del *.txt
    ren *.t$t *.txt
    popd
    

    • 0