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.

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



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

No comments:

Post a Comment