Jump to content

Recommended Posts

Posted

PROLEM :

A HAVE A TEXTFILE WITH 2 LINES:

[WFCINIT]

PCNAME=ABC12345

HOW 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


Posted

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 ... )

Posted

Ofcourse ineXPlicable is right about the homework

and alanol bout the screaming

so 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.txt

or (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.txt

gr /\/\o\/\/

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...