eblissone Posted June 7, 2004 Posted June 7, 2004 PROLEM :A HAVE A TEXTFILE WITH 2 LINES:[WFCINIT]PCNAME=ABC12345HOW CAN I MAKE A DOS BATFILE THAT FILTER THE PCNAME=ABC12345 AND CREATE AUTOMAICALY A TEXFILE WITH THE NAME ABC12345.TXT AND IN THE TEXTFILE HAVE A LINE WITH : ABC12345 Errol
GreenMachine Posted June 7, 2004 Posted June 7, 2004 FINDSTR in a FOR loop will get the strings you need, TOKENS in the FOR loop will let you pick your piece of the string, and delimeter. TYPE and ECHO can be used to write strings, and the ">" redirect sign lets you output to a file named to your liking.(You are not looking for someone to do your homework, are you now ... )
/\/\o\/\/ Posted June 7, 2004 Posted June 7, 2004 Ofcourse ineXPlicable is right about the homework and alanol bout the screamingso i won't give you the batchfile, but if you double the %-signs in the following onliner you can make it a batch-file for /f "tokens=2 delims== " %i in (test.txt) do echo %i > %i.txtor (if you have more lines with an =-sign in it)for /f "tokens=1,2 delims== " %i in (test.txt) do echo %i | findstr "PCNAME" && echo %j > %j.txtgr /\/\o\/\/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now