
Re: Batch files to convert files
looll this is not converting it's just renaming but i explane you the code.
Code:
@echo off
title Bmp Converter
goto Start
:Start
SET INPUT=
ECHO.
ECHO Make a choice...[lower case]
ECHO.
ECHO converts BMP files only
ECHO.
ECHO GIF = Convert to *.Gif
ECHO PNG = Convert to *.Png
echo JPG = Convert to *.Jpg
ECHO.
SET /P INPUT=gif/png/jpg:
if "%input%" =="" GOTO Start
if "%input%" =="gif" GOTO gif
if "%input%" =="png" GOTO png
if "%input%" =="jpg" GOTO jpg
:gif
ECHO Converting
rename *.bmp *.gif
ECHO progress 100%
ECHO done
PAUSE
exit
:png
ECHO Converting
rename *.bmp *.png
ECHO progress 100%
ECHO done
PAUSE
exit
:jpg
ECHO Converting
rename *.bmp *.jpg
ECHO progress 100%
ECHO done
PAUSE
exit
Echo is a command that makes appears output text (ex: Echo Hey - output Hey)
rename it's a command that changes the name of the files or their extension but it for changing extension works very bad.
goto it's a command that is used with the :, ( example you put goto p and lines above you put :p, and when you open your batch file that go to the part of the code where is the :p)
Pause it's just for pause the code but if you press any button it will go on
set /p it's a code that defines variables (example you put set /p k= hey and later you put echo %k% it will say hey)
exit it's to leave batch program
if it's a command to compare variables ex if %l%=="5" goto x
Regards, rfpd