Quick DOS script to create files based on the contents of a text file

There’s plenty of times where I find myself thinking that there must be an easy way of doing a dull and repetive task- for example, creating a bunch of files based on a CSV file – so the line below will simply take a text document (x.txt) and create new files with the contents of each line in the document in the same directory with the same name:

for /f “tokens=*” %l in (x.txt) do @type nul > “%l.txt”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s