.bat file to rename files (not bulk)

Posted on

QUESTION :

I take pictures of airplanes.

When i put them on the computer they are named DCS_5678 (or anotrher number :p )
The way i catalogue my pictures is by renaming them as followed: number_Airline_Typeofaircraft_Tailnumber_date_airport, so it looks like this: 3968_UnitedAirlines_Boeing777-222_N778UA_15-08-2014_EBBR so another picture will be called like: 5460_BrusselsAirlines_AvroRJ100_OO-DWL_16-08-2014_EBBR

what i remember about .bats is not much and i cant realy find what i am looking for.
This is how far i get:
Code:

@echo Filerenamer
@echo Airportcodes: EBBR = Brussels Airport, EBMB = Melsbroek Military Airport, EHAM = Amsterdam Schiphol, EGGL = London Heathrow, EBAW = Antwerp International Airport, EBOS = Ostend Airport, more on http://en.wikipedia.org/wiki/List_of_airports_in_Belgium
@echo _____________________________________________________________________________
@echo
@echo
@echo Enter filename to rename
???????????????????????????????????
@echo Enter new name
???????????????????????????????????
@echo File renamed. Rename other file? y/n
???????????????????????????????????

cant remember what to place in the place of the ????’s and how that the question can be answered with y or n (if y then it should go bach to asking the question to enter filename, …, if n it should as confirmation to close the command screen

Anyone can help with this?

Thank you

for the y/n question i have found how to do it

 @echo off
:start
cls
echo Filerenamer
echo Airportcodes: EBBR = Brussels Airport, EBMB = Melsbroek Military Airport, EHAM = Amsterdam Schiphol, 
echo EGGL = London Heathrow, EBAW = Antwerp International Airport, EBOS = Ostend Airport
echo More codes on http://en.wikipedia.org/wiki/List_of_airports_in_Belgium
pause
echo Rename aother file? y/n
set /p choose=
if %choose%==y goto :start
echo Press any key to exit.
Pause
:exit

now still need to figure out how to give in the filename and the new filename

ANSWER :

Looks like this is what i wanted 😀

 @echo off
:start
cls
echo ****************************************************************************************
echo *                                    FILERENAMER                                       *
echo *                                                                                      *
echo *                           Belgian Airport ICAO codes                                 *
echo *     -Bevekom EBBE          -Bierset EBLG              -Deurne EBAW                   *
echo *     -Charleroi EBCI        -Grimbergen EBGB           -Hasselt EBZH                  *
echo *     -Koksijde EBFN         -Kortrijk/Wevelgem EBKT    -Leopoldsburg/Beverlo EBLE     *
echo *     -Melsbroek EBMB        -Moorsele EBMO             -Oostende EBOS                 *
echo *     -Saint-Ghislain EBSG   -Namen EBNM                -Zaventem EBBR                 *
echo *     -Florennes EBFS        -Genk EBZW                 -Kleine-Brogel EBKB            *
echo *     -Malle/Zoersel EBZR    -Zuienkerke EBZU                                          *
echo ****************************************************************************************
pause
echo What file do you like to rename?
set /p name1=
echo How would you like to name it? (number_Airline_Type_Tailnumber_date_ICAO)
set /p name2=
rename %name1% %name2%.JPG
echo Rename another file? y/n
set /p choose=
if %choose%==y goto :start
echo Press any key to exit.
Pause
:exit

Leave a Reply

Your email address will not be published.