New FLIGHTGEAR CHOICE OPTION Batch File

Netgear / Dg834g
June 14, 2011 at 01:37:03
Specs: Windows XP SP3, 4000+ / 2gb DDR
Just wanted to share a new batch file I have made to make it easier to swap the system folders around that flightgear stores settings inside if anyone can make this even more compact and easier to use I am interested in your input. This batch file works very well but could use some stream-lining...

I have put a fair amount of :: comments in this batch file it makes it look bigger than it really is as these can be removed if necessary but for now the comments are their to assist explaining how my batch works.

@echo off
:: PLEASE NOTE THIS BATCH FILE IS STILL BEING WRITTEN
:: IT'S A WORK IN PROGRESS!! June 2011 FOR FLIGHTGEAR
:: Written by Aerotro v2.6
:: NOTE: this batch will be further improved in time
:: Updates may be found here:
:: ftp://UNITYALLIANCE:Aer010242017namASte"ortorea.dnsalias.org/FTP-Programs/flightgear-choice.zip
::
:: ***************************************************
echo MAKE A CHOICE OF WHAT FLIGHTGEAR VERSION TO START
echo FOR CLARITY and ease of use we are naming the
echo FLIGHTGEAR BINARIES BY THEIR ORIGINAL COMPILE
echo DATE FORMAT This Aids in Avoiding any Confusion.
echo.
:: *************************************************** v COMMAND EDITABLE REGION IN THIS BLOCK
:: ***************************************************
:: ***************************************************
:: ***************************************************
:: MAIN SYSTEM CONFIGURATION !!! PLEASE TAKE CARE
:: SETTING THE MAIN PATHS HERE ; set variables
:: take special care below the path starts with an "
:: but it MUST NOT end with an " because this is only
:: 1st half of the path the second half is filled in
:: below the section labeled SETTING / CHECKING STATUS
:: EXAMPLE: such as: %path%\%fgsys0%" <this is 2nd Part.
setlocal enabledelayedexpansion
:: --------------------------------------------------
:: ****** SETTING TEXTUAL DISPLAY VARIABLES HERE *****
set text1=* IF During a RESTORATION From/Too a Backup Folder! *
set text2=* YOU ARE ASKED IF THIS IS A DIRECTORY or FILE -
set text3= You should PRESS D (DIRECTORY) ...
set text100=Some Portions of this Batch Maybe Disabled
:: Below where every the text displayed use the following:
:: echo %text1%
:: I am only using TEXT variables in places of duplication
:: --------------------------------------------------
:: QUICK ENABLE / DISABLE OF ALL FGRUN Options HERE!
set starting=start
:: to disable change: set starting=[start] [:: start]
:: --------------------------------------------------
:: now theirs no need to type text above over & over. it
:: can use variables below to only type it here 1 time.
:: --------------------------------------------------
:: To Make it easier to change global values to all
:: sections of this batch file all you need to change
:: are the following value DATES Plus Folder Paths Below!
:: --------------------------------------------------
:: Main default path's
set path="C:\Documents and Settings\JulieCVS\Application Data
set fgsys0=flightgear.org
set home@fgfs="C:\Documents and Settings\JulieCVS\Application Data\flightgear.org"
:: --------------------------------------------------
:: bindate is an abreviation for Binary Dates PLUS!
:: this means your FOLDERS would be named like this!
:: i.e. flightgear.org.01012011 (Section below is the numeric portion)
:: (You also need to set the paths) i.e. x:\Program Files\FlightGear\
:: try to avoid changing the VARIABLES inside the %variable%
:: --------------------------------------------------
:: Please check the paths and drive letters are right!
:: CHANGE The 'FOLDER Date Values' AFTER The =''
set bindate1=27062009
set bindate2=04042010A
set bindate3=08112010A
set bindate4=08062011
:: Set the variables above these will be carried forward
:: to the other paths below. except you will need to also
:: --------------------------------------------------
:: Dynamic Choice Paths are flightgear.org.xxxxxxxx
set fgsys1=flightgear.org.%bindate1%
set fgsys2=flightgear.org.%bindate2%
set fgsys3=flightgear.org.%bindate3%
set fgsys4=flightgear.org.%bindate4%
:: --------------------------------------------------
:: EXECUTABLE WIN32 PATH SET ["DRIVE:\X]\%bindate0%\"
set EXEFGFS1="F:\Program Files\FlightGear\%bindate1%\"
set EXEFGFS2="F:\Program Files\FlightGear\%bindate2%\"
set EXEFGFS3="F:\Program Files\FlightGear\%bindate3%\"
set EXEFGFS4="F:\Program Files\FlightGear\%bindate4%\"
:: --------------------------------------------------
:: What Drive letter is the ROOT for this batch file ?
g:
cd\datacvs
::
:: --------------------------------------------------
:: THIS SECTION RENAMES BACK-LAST ACTIVE flightgear.org
:: FOLDER TO ARCHIVE NAME i.e. flightgear.org.xxxxxxxx
::
if not exist "c:\state" md "c:\state"
set state=c:\state
:: *************************************************** ^ END COMMAND EDITABLE REGION IN THIS BLOCK
:: *************************************************** ALL FIXED VARIABLES BELOW
:: ***************************************************
:: ***************************************************
:: ************ SETTING / CHECKING STATUS ************
if not exist %path%\%fgsys0%" goto cont
if exist %state%\A1.txt rename %path%\%fgsys0%" "%fgsys1%"
if exist %state%\A2.txt rename %path%\%fgsys0%" "%fgsys2%"
if exist %state%\A3.txt rename %path%\%fgsys0%" "%fgsys3%"
if exist %state%\A4.txt rename %path%\%fgsys0%" "%fgsys4%"
if exist %state%\A*.txt del %state%\A*.txt
if exist %path%\%fgsys0%" goto exists
sleep 3
:: ***************************************************
:cont
cls
color 17
echo.
:repeat
cls
:: ***************************************************
:: Checking for missing files that can cause faults!
if not exist CHOICE.COM echo CHOICE.COM missing
if not exist SLEEP.COM echo SLEEP.COM missing
if not exist xcopy.exe echo xcopy.exe missing
echo.
echo *****************
echo ***************************************************
if not exist CHOICE.COM goto missing
if not exist SLEEP.COM goto missing
if not exist xcopy.exe goto missing
cls
echo **********************************************
echo Please press (A) To RUN flightgear %bindate1%
echo Please press (B) To RUN flightgear %bindate2%
echo Please press (C) To RUN flightgear %bindate3%
echo Please press (D) To RUN flightgear %bindate4%
echo ----------------------------------------------
echo Please press (E) To Check if STATE files exist
echo This Menu will repeat after viewing the status.
echo ----------------------------------------------
echo Please press (F) To QUIT (Default 99 Seconds)
echo ----------------------------------------------
echo Written by Aerotro June 2011 to Make FGFS more
echo user friendly providing a choice what Ver runs
echo **********************************************
echo.
Choice /t:f,99/c:abcdef
if errorlevel 6 goto quit
if errorlevel 5 goto status
if errorlevel 4 goto start-fg4
if errorlevel 3 goto start-fg3
if errorlevel 2 goto start-fg2
if errorlevel 1 goto start-fg1
:: ***************************************************
:start-fg1
:: ***************************************************
echo %text1%
echo %text2%
echo %text3%
echo.
sleep 5
cls
if not exist %path%\%fgsys1%" xcopy /s /h /y /k %path%\%fgsys1%.bak" %path%\%fgsys1%"
sleep 3
if not exist %path%\%fgsys1%.bak" xcopy /m /s /h /y %path%\%fgsys1%" %path%\%fgsys1%.bak"
sleep 3
if exist %path%\%fgsys1%\*autosave*" rename %path%\%fgsys1%" %fgsys0%"
sleep 3
if not exist %path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate1% fgrun.exe
echo %text100%
%starting% "FLIGHTGEAR-%bindate1%" /D%EXEFGFS1% /LOW fgrun.exe
echo A1 > %state%\A1.txt
sleep 5
cls

:: ***************************************************
GOTO END
:: ***************************************************
:start-fg2
:: ***************************************************
echo %text1%
echo %text2%
echo %text3%
echo.
sleep 3
if not exist %path%\%fgsys2%" xcopy /s /h /y /k %path%\%fgsys2%.bak" %path%\%fgsys2%"
sleep 3
if not exist %path%\%fgsys2%.bak" xcopy /m /s /h /y %path%\%fgsys2%" %path%\%fgsys2%.bak"
sleep 3
if exist %path%\%fgsys2%\*autosave*" rename %path%\%fgsys2%" %fgsys0%"
sleep 3
if not exist %path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate2% fgrun.exe
echo %text100%
%starting% "FLIGHTGEAR-%bindate2%" /D%EXEFGFS2% /LOW fgrun.exe
echo A2 > %state%\A2.txt
sleep 5
cls

:: ***************************************************
GOTO END
:: ***************************************************
:start-fg3
:: ***************************************************
echo %text1%
echo %text2%
echo %text3%
echo.
sleep 3
if not exist %path%\%fgsys3%" xcopy /s /h /y /k %path%\%fgsys3%.bak" %path%\%fgsys3%"
sleep 3
if not exist %path%\%fgsys3%.bak" xcopy /m /s /h /y %path%\%fgsys3%" %path%\%fgsys3%.bak"
sleep 3
if exist %path%\%fgsys3%\*autosave*" rename %path%\%fgsys3%" %fgsys0%"
sleep 3
if not exist %path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate3% fgrun.exe
echo %text100%
%starting% "FLIGHTGEAR-%bindate3%" /D%EXEFGFS3% /LOW fgrun.exe
echo A3 > %state%\A3.txt
sleep 5
cls

:: ***************************************************
GOTO END
:: ***************************************************
:start-fg4
:: ***************************************************
echo %text1%
echo %text2%
echo %text3%
echo.
sleep 3
if not exist %path%\%fgsys4%" xcopy /s /h /y /k %path%\%fgsys4%.bak" %path%\%fgsys4%"
sleep 3
if not exist %path%\%fgsys4%.bak" xcopy /m /s /h /y %path%\%fgsys4%" %path%\%fgsys4%.bak"
sleep 3
if exist %path%\%fgsys4%\*autosave*" rename %path%\%fgsys4%" %fgsys0%"
sleep 3
if not exist %path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate4% fgrun.exe
echo %text100%
%starting% "FLIGHTGEAR-%bindate4%" /D%EXEFGFS4% /LOW fgrun.exe
echo A4 > %state%\A4.txt
sleep 5
cls

:: ***************************************************
GOTO END
:: ***************************************************
:: MORE FGFS OPTIONS HERE LATER

:: ***************************************************
:error
color 4f
cls
echo FATAL ERROR MISSING:
echo.
echo %path%\%fgsys0%"
echo.
echo Most likely the folder normally located at
echo %path%\%fgsys0%"
echo.
echo Also the backup does not exist or is named wrong!
echo or perhaps you have not properly configured this
echo batch file ?
echo.
pause
:abort
cls
echo ABORTING
sleep 4
goto quit
:: ***************************************************
:exists
color 4f
cls
echo A SYSTEM FOLDER CALLED flightgear.org
echo ALREADY EXISTS, Please Manually Check
echo The Contents of this folder RENAMING
echo or moving this folder may mix up the
echo the version history and cause errors!
echo.
echo It appears that either this batch file
echo has been damaged and is not working as
echo it should do, or the folders are locked
echo by the operating system preventing renaming.
echo.
pause
start explorer.exe %home@fgfs%
pause
cls
goto DONE
:: ***************************************************
:status
cls
echo Here are the status files for examination IF THEY EXIST!
echo It is a good sign if their are no status files remaining
echo it means the batch file is working ok, in so far it has
echo not left a flightgear.org file in the system folder and
echo forgotten about it :)
echo.
echo when ready we can return to the choices !!!
echo Main Choice Menu will Display again after a key press.
start explorer.exe %state%
pause
cls
goto repeat
:: ***************************************************
:missing
color 4f
echo You appear to be missing important files for this
echo batch to operate correctly, It is important that
echo you have the ABOVE files in the root were this bat
echo file resides, you should have got these at the same
echo time you got this batch file here is a list.
echo ---------------------------------------------------
echo CHOICE.COM;SLEEP.COM;xcopy.exe ( 1 or more missing)
echo ***************************************************
pause
goto quit
:END
cls
echo Flightgear Should be Running by now!
echo The NEXT time this batch file is run
echo the path that was just initiated for
echo flightgear.org will be restored to its
echo original archive path name!
echo.
echo Please DO NOT DELETE the A1,B2,C3, etc flags!
echo Stored in %state%
echo.
:DONE
sleep 30
:quit
cls


See More: New FLIGHTGEAR CHOICE OPTION Batch File

Report •

#1
June 20, 2011 at 06:26:58
Perhaps someone can help me I want to do some double if exist / if not exist for 2 variables can someone advise me how to do this:

if not exist %condition1% plus not exist %condition2% then do this! and this!

Thanks, Michelle


Report •
Related Solutions


Ask Question