Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers 2

This should work just fine:

@echo off
set /p VERSION= < version.log
echo "nothing" > "%VERSION%.txt"
share|improve this answer
2  
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
add comment

XYZ

@echo off
setlocal

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.