script to rename file based on a string in the first line

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jkea
Posts: 1
Joined: 28 May 2008 08:52

script to rename file based on a string in the first line

#1 Post by jkea » 28 May 2008 09:20

I need to write a batch file that will rename a file based on a string in the first line of the file (a header).

The routine will need to move to a certain position in the first line and read in the next, say 12 positions, into a variable, then name the file based on the string value that was passed to the variable.

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

#2 Post by jeb » 29 May 2008 13:56

Hi Ikea,

take a look at the for /f "tokens=..." command, that should do the work for you.

jeb

Post Reply