Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Someone help me to create a batch file to extract information from a file and create another with that information?

The file "version.log" contains only the information "v1.0"

I want to create a text file with that information "v1.0.txt"

share|improve this question

This should work just fine:

@echo off
set /p VERSION= < version.log
echo "nothing" > "%VERSION%.txt"
share|improve this answer
Or a type nul instead of echo "nothing", if you want an empty file. – Bob Jul 6 '12 at 21:30
@Bob: Cool. I wanted to write touch first, but couldn't come up with the Windows equivalent. Thanks! :) – Oliver Salzburg Jul 6 '12 at 21:31
That's exactly what I wanted. Very very thank you very much – Rui Aguiar Jul 6 '12 at 21:43


@echo off

set FILE=log.txt
:: Read first line of the file
for /F "tokens=*" %%x in (%FILE%) do (set STR=%%x) && (goto out)
fsutil file createnew %STR% 0
pause 1>nul
share|improve this answer
fsutil file createnew %STR%.txt 0? – martineau Jul 7 '12 at 2:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .