Bat file to insert line feed

March 31, 2011 at 10:19:35
Specs: Windows XP
I have several one-line files that should have a line feed after each forward slash.
I'm using a variation of a previous post from IVO, and it is generating the line feeds as it should, but mine is also stripping out all the commas in the file, which is bad. Here's what I've got:

For /f "tokens=* delims=" %%a in (%*) Do (
Call :SPLIT %%a)
GoTo :EOF

:SPLIT
Set Line=%*
Set Line=%Line:/=/@%
Echo %Line%
For /f "tokens=1,* delims=@" %%a in ('Echo %Line%') Do (
Echo.%%a
echo.
If not "%%b"=="" Call :SPLIT %%b)
GoTo :EOF


See More: Bat file to insert line feed

Report •


#1
April 2, 2011 at 15:03:56
@echo off
For /f "tokens=* delims=" %%a in (A.txt) Do (
Call :SPLIT %%a)
GoTo :EOF

:SPLIT
Set Line=%*
rem Set Line=%Line:/=@%
rem Echo %Line%
For /f "tokens=1,* delims=/" %%a in ("%Line%") Do (
Echo.%%a/
echo.
If not "%%b"=="" Call :SPLIT %%b)
GoTo :EOF


Report •
Related Solutions


Ask Question