I am working on a project to change .txt files to .vbs files without manually changing the extension... How would I change the file extension using c++ so that I could just input a file name and it would get that .txt file and change it to a .vbs file?
@echo off
if %1.==. goto help
if %2.==. goto help
goto :run
:help
echo. chext *EXT1 EXT2
echo. Changes all files with EXT1 to use EXT2.
echo. For example, to change all .txt files to .vbs files
echo. chext *.txt .vbs
echo.
goto :end
:run
for %%F in (%1) do ren %%F %%~nF%2
:end
If you really want to do it with C++, you should check out Boost.Filesystem.