Friday, May 18, 2012

C++ to Text file converter

Hi guys i have made a Batch File code by which you can convert C++ File to Text File.
I know that we can convert it by using notepad. But for understanding the purpose of Batch Coding you can try this. This code changes the file extension of C++ (.cpp) to Text (.txt). So, we can assume that your file gets converted into text file.

@echo off
Set /P userin=Enter the File name
ECHO file name is =%userin%
set str1=%userin:.cpp=%
set "str2=%str1%.txt
pause: Press any key to convert it into Text file
COPY %userin% %str2%

Save this code with .bat extension. When you run this code, use the whole path specifying the drive later also.