I have created a file, file1.txt, the content of this file is like "abcdef". I want to read the content of this file and wish to store content in another file "output.txt" using a batch file.
Please let me know how to do it from batch file.
I have created a file, file1.txt, the content of this file is like "abcdef". I want to read the content of this file and wish to store content in another file "output.txt" using a batch file.
Please let me know how to do it from batch file.
Your batch file could simply copy the file to the new filename.
copy c:\file1.txt c:\output.txt
Ruchi, your question sounds like you simply want to copy the contents of the file from 'FILE1.TXT' to 'OUTPUT.TXT', is that right? You do not want to change the file in any way? If so, there are lots of ways to do this:
@ECHO OFF
COPY C:\FILE1.TXT C:\OUTPUT.TXT
or
@ECHO OFF
TYPE C:\FILE1.TXT > C:\OUTPUT.TXT
for example.
You can do this to overwrite the existing file:
type file1.txt > output.txt
You can do this to append to the existing file:
type file1.txt >> output.txt
@echo off
rem -- output file1 to file2 --
type %1 > %2
To use it, say the batch file is named output.bat, use command:
output.bat input.txt output.txt