Friday, May 25, 2007

My first FOR-IN-DO LOOP in a batch file.

FOR.BAT
==================
FOR %%F IN (*.TXT) DO CALL TEST.BAT "%%F"

The quotes make it work in DOS for filenames with spaces.

TEST.BAT
==================
@echo off
Type %1 > file_.txt
Del %1
copy file_.txt %1
del file_.txt

2 Comments:

At May 25, 2007 at 12:32 PM , Blogger Kurt Schroeder said...

This removes Unicode.

 
At November 11, 2008 at 2:05 AM , Anonymous Anonymous said...

Thanks for writing this.

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home