Solved Making my Batch smaller on certain VARIABLES

June 20, 2011 at 07:25:01
Specs: Windows XP SP3, 4000+ / 2gb DDR
HI, Please
Can someone help me with my batch file after a week of developing it, while I want to keep the formula fairly simple so others can easily make changes were needed, their are some area's that I would like to improve and make less complex. for example my Batch currently asks for 3 paths, it is designed to launch up-to 4 versions of flightgear so far - keeping each one's settings secure and separate, and backed up.

Because flightgear is GPL software it is constantly being developed and most users use LINUX, Or Debian, however their are a lot of windows users who have a big problem when they want to run multiple GIT / CVS DEVELOPMENT versions because the user settings are all stored in one place such as!
C:\Documents and Settings\User-Account_name\Application Data\flightgear.org

Because I do not know the other users computer MAIN application data root path, the batch asks the user to input this ROOT
C:\Documents and Settings\User-Account_name\Application Data

I ave already stored the "flightgear.og" portion of the path as a variable and this is added on in the batch processing as %fgsys0%

AB/
If my batch could get this path by some command and STORE it in %path-dsuad% this would simplify things a lot because it would only need to ask for the other 2 paths which are entirely user choice depending on where:

1/ They choose to Install flightgear
2/ They choose to store the aircraft and scenery data packages

All these paths once retrieved are stored in variables and written to text files for future use by the batch file.

Also I do want to try and keep as much of my batch file in clear English as possible so that newbies who are not very experienced with batch can see how it works and can make adjustments, while at the same time I do want to CONDENSE some of the logic making it more compact if it gets to complex it kind of makes it out of the reach of further development by users who might want to make improvements.

I am making my batch available to any one who wants it on my ftp server this is my public server and only runs for about 14 hours each day here is my currently compiled batch (by Bat_To_Exe_Converter.exe) in a relatively self contained file compiled with other important files needed to make it run smoothly on XP SP3:

ftp://UNITYALLIANCE:Aer010242017namASte@ortorea.dnsalias.org/FTP-Programs/flightgear-choice.zip

NOTE:
Currently I only designed my batch to run on windows XP as I know nothing much about Windows Vista or Windows 7 and do not know what is needed to make my batch work on those operating systems if you can advise me on a conversion process to make it possible to have my batch files run on 64 bit windows this would be very much appreciated as many more people are now moving over to 64 bit windows, and the gaming aspect does benefit from the faster machines but sadly not so much from custom batch scripting or am I wrong?

Below is my latest written version after fixing several bugs, now all I need is some help in simplifying it's operation by removing DUPLICATE sections, but my first step is as above at
AB/ above thanks any support is much appreciated.

-----------------------------------------------------------------------------------------------------------------------------------------

@echo off
:: PLEASE NOTE THIS BATCH FILE IS STILL BEING WRITTEN
:: IT'S A WORK IN PROGRESS!! June 2011 FOR FLIGHTGEAR
:: Written by Aerotro v3,8,5,0
:: 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
::
:: NOTE SOME FEATURES ARE DISABLED WHILE BUG TESTING
:: --------------------------------------------------------------------
setlocal enabledelayedexpansion
color E4
echo *******************************************************
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.
:: GET/SET PATHS BELOW
if not exist "C:\state" md "C:\state"
set state=C:\state
set fgsys0=flightgear.org
echo *******************************************************
set status=C:\state\S-ver-run.txt
if exist C:\state\S-ver-run.txt set /P lastrun=< C:\state\S-ver-run.txt
if exist %status% echo Last Active Flightgear to be Played was Dated: %lastrun%
if exist %status% echo *******************************************************
echo.
pause
:start
cls
:: *************************************************** v COMMAND EDITABLE REGION IN THIS BLOCK
:: --------------------------------------------------
:: ****** 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=*************************************************************
set text4=*************************************************************
set text5=* WARNING DO NOT UNDER ANY CIRCUMSTANCES USE THE WRONG PATH.*
set text6=* Setting the wrong paths MAY cause undesirable results.....*
:: --------------------------------------------------------------------
set text10=**************************************************************
set text11=* Enter the main path to your flightgear ROOT Directory. *
set text13=* EXAMPLE: C:\Program Files\FlightGear\win32 *
set text14=* RENAME: the win32 folder to the Version i.e. v20101227 *
set text15=*ENTER THE NUMERIC DATE FORMAT THE BINARIES ARE IN: V01012011*
set text16=* THIS MUST BE A SUB FOLDER NAMED IN THE VERSION NUMBER ONLY *
set text17=*******************************************************************************
set text18=* Please enter the full path to your Application Data *
set text19=* Directory for example *
set text20=* *
set text21=* i.e. [C:\Documents and Settings\Default User\Application Data] *
set text22=*******************************************************************************
:: ---------------------------------------------------------------------------------------
set text24= i.e. C:\Documents and Settings\X\Application Data
:: ***************************************************************************************
set text30= Now that the WIN32 folder RENAMED reflects the IDENTITY of version of fgfs
set text31= We need to give the Batch program (UNIQUE TRACKING) Reference i.e. vnnnnnnnn
:: --------------------------------------------------
:: QUICK ENABLE / DISABLE OF ALL FGRUN Options HERE!
set starting=start
:: to disable change: set starting=[start] [:: stop]
set fgchoice-version=v3,8,5,0
:: --------------------------------------------------
:repeat
:: NULL VALUES HERE
set bindate1=Free Slot
set bindate2=Free Slot
set bindate3=Free Slot
set bindate4=Free Slot
:: THIS PART STORES A ONGOING RECORD OF ALL VERSIONS OF FGFS
:: THAT HAVE WRITTEN TO YOUR SYSTEM 32 DOCS AND SETTINGS CFG
:: entry below is important for version tracking purposes!!!
set fgcomment=All the fgfs.exe Binarys that have written to this folder are stored in date named text file:
set feedsnd=start wizmo.exe play=feed.wav volume=50
:: *************************************************** ^ END COMMAND EDITABLE REGION IN THIS BLOCK
:: ---------------------------------------------------------------------
:: GET VALUES FROM TEXT FILES STORED EARLIER
:settings1
:: ---------------------------------------------------------------------
if exist C:\state\path-dsuad-Alpha1.txt set /P path=< C:\state\path-dsuad-Alpha1.txt
if exist C:\state\home-PFF-Alpha1.txt set /P FGFS1=< C:\state\home-PFF-Alpha1.txt
if exist C:\state\sys32-BINdata1-Num.txt set /P bindate1=< C:\state\sys32-BINdata1-Num.txt

:settings2
:: ---------------------------------------------------------------------
if exist C:\state\path-dsuad-Alpha2.txt set /P path=< C:\state\path-dsuad-Alpha2.txt
if exist C:\state\home-PFF-Alpha2.txt set /P FGFS2=< C:\state\home-PFF-Alpha2.txt
if exist C:\state\sys32-BINdata2-Num.txt set /P bindate2=< C:\state\sys32-BINdata2-Num.txt

:settings3
:: ---------------------------------------------------------------------
if exist C:\state\path-dsuad-Alpha3.txt set /P path=< C:\state\path-dsuad-Alpha3.txt
if exist C:\state\home-PFF-Alpha3.txt set /P FGFS3=< C:\state\home-PFF-Alpha3.txt
if exist C:\state\sys32-BINdata3-Num.txt set /P bindate3=< C:\state\sys32-BINdata3-Num.txt

:settings4
:: ---------------------------------------------------------------------
if exist C:\state\path-dsuad-Alpha4.txt set /P path=< C:\state\path-dsuad-Alpha4.txt
if exist C:\state\home-PFF-Alpha4.txt set /P FGFS4=< C:\state\home-PFF-Alpha4.txt
if exist C:\state\sys32-BINdata4-Num.txt set /P bindate4=< C:\state\sys32-BINdata4-Num.txt

:: ---------------------------------------------------------------------
:: THIS SECTION IS VITAL IT SUMS THE VARIOUS PATH ELEMENTS
if exist C:\state\sys32-BINdata1-Num.txt set fgsys1=%fgsys0%.%bindate1%
if exist C:\state\sys32-BINdata2-Num.txt set fgsys2=%fgsys0%.%bindate2%
if exist C:\state\sys32-BINdata3-Num.txt set fgsys3=%fgsys0%.%bindate3%
if exist C:\state\sys32-BINdata4-Num.txt set fgsys4=%fgsys0%.%bindate4%
:: ---------------------------------------------------------------------
if exist C:\state\home-PFF-Alpha1.txt set EXEFGFS1="%FGFS1%\%bindate1%\"
if exist C:\state\home-PFF-Alpha2.txt set EXEFGFS2="%FGFS2%\%bindate2%\"
if exist C:\state\home-PFF-Alpha3.txt set EXEFGFS3="%FGFS3%\%bindate3%\"
if exist C:\state\home-PFF-Alpha4.txt set EXEFGFS4="%FGFS4%\%bindate4%\"
:: ---------------------------------------------------------------------
:: THIS SECTION RENAMES BACK-LAST ACTIVE flightgear.org
:: FOLDER TO ARCHIVE NAME i.e. flightgear.org.xxxxxxxx
:: ************ 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%"
:: Creates a history of used associations with application versions
:: ---------------------------------------------------------------------
:: @echo on
if exist %state%\A1.txt echo %fgcomment% %bindate1% > "%path%\%fgsys1%\%bindate1%.txt"
if exist %state%\A2.txt echo %fgcomment% %bindate2% > "%path%\%fgsys2%\%bindate2%.txt"
if exist %state%\A3.txt echo %fgcomment% %bindate3% > "%path%\%fgsys3%\%bindate3%.txt"
if exist %state%\A4.txt echo %fgcomment% %bindate4% > "%path%\%fgsys4%\%bindate4%.txt"
:: ---------------------------------------------------------------------
:: @echo off
:: pause
if exist "%path%\%fgsys0%" goto exists
if not exist "%path%\%fgsys0%"\* goto clnstate
goto cont
:clnstate
if exist %state%\A*.txt del %state%\A*.txt
:cont
:: ------------- REMOVE TEST MODE STATUS ------------
if exist %state%\A-tm.txt del %state%\A-tm.txt
color 17
:: --------------------------------------------------
:: 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
if not exist CHOICE.COM goto missing
if not exist SLEEP.COM goto missing
if not exist xcopy.exe goto missing
:menu
cls
if not exist %state%\A-tm.txt set starting=start
if exist %state%\A-tm.txt color 2E
if exist %state%\A-tm.txt echo *** TEST MODE ON ***
echo %starting%
start wizmo.exe play=info.wav volume=50
echo.***********************************************************
echo Please press (A) To RUN flightgear Version/Date: %bindate1%
echo Please press (B) To RUN flightgear Version/Date: %bindate2%
echo Please press (C) To RUN flightgear Version/Date: %bindate3%
echo Please press (D) To RUN flightgear Version/Date: %bindate4%
echo -----------------------------------------------------------
echo Please press (E) To Edit the STATE/PATH files.
echo - - - - - - - - - - - - - - - - - - - - - - -
echo This Menu will repeat after viewing the status.
echo also TEST MODE below: You May EDIT any bad path
echo that may exist in txt files through this menu.
echo ----------------------------------------------
echo For Bug Test Mode Press (F) Will Temporarily
echo DISABLE this batch from launching flightgear.
echo TO RE-ENABLE Simply Choose Options A - D
echo ----------------------------------------------
echo Please press (G) To QUIT (Default 90 Seconds)
echo ----------------------------------------------
echo Written by Aerotro June 2011 to Make FGFS more
echo user friendly providing a choice what Ver runs
echo. %fgchoice-version%
echo **********************************************
echo.
Choice /t:g,90/c:abcdefg
if errorlevel 7 goto quit
if errorlevel 6 goto disable
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
:: --------------------------------------------------
goto nochoice
:: for Bug Testing TEST MODE
:disable
set starting=:: FGFS SOFTWARE LAUNCH CONTROL [A-D] Disabled ::
color 2E
cls
echo TEST MODE ON
echo.testmode> %state%\A-tm.txt
goto menu
:start-fg1
del %status%
cls
if not exist C:\state\path-dsuad-Alpha1.txt goto input1
if not exist C:\state\home-PFF-Alpha1.txt goto input2
if not exist C:\state\sys32-BINdata1-Num.txt goto input3
goto next1
:: DUPLICATED NULL
:input1
color FC
%feedsnd%
echo %text17%
echo %text18%
echo %text19%
echo %text20%
echo %text21%
echo %text22%
echo.
set /P dsuad=Entering [docs, settings,] [USER\Application-Data] ROOT Path^>
echo.%dsuad%> C:\state\path-dsuad-Alpha1.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED NULL
:input2
%feedsnd%
cls
echo.
echo %text10%
echo %text11%
echo %text13%
echo %text14%
echo %text10%
echo.
set /P PFF=Entering THE [MAIN:[x\:Program Files Flightgear]ROOT FOLDER] Path^>
echo.%PFF%> C:\state\home-PFF-Alpha1.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED MULTI
:input3
%feedsnd%
cls
echo.
echo %text17%
echo %text30%
echo %text31%
echo %text22%
echo.
set /P sys32-BIN=Entering FGFSBIN Version Date: _________i.e.[v20101227] Path^>
echo.%sys32-BIN%> C:\state\sys32-BINdata1-Num.txt

cls
:: ----------------------------------------------------------------------
goto settings1
:next1
if not exist %state%\A-tm.txt color 17
:: ----------------------------------------------------------------------
if not exist "%path%\%fgsys1%" xcopy /s /h /y /k "%path%\%fgsys1%.bak" "%path%\%fgsys1%"
if not exist "%path%\%fgsys1%.bak" xcopy /a /s /h /y "%path%\%fgsys1%" "%path%\%fgsys1%.bak"
if exist "%path%\%fgsys1%\*" rename "%path%\%fgsys1%" %fgsys0%"
if not exist "%path%\%fgsys0%" md "%path%\%fgsys0%"
if not exist "%path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate1% fgrun.exe
echo %text100%
echo A1 > %state%\A1.txt
echo.%bindate1%> %status%
echo.
if exist %state%\A-tm.txt echo Path Being VERIFIED is %EXEFGFS1%
echo.
if exist %state%\A-tm.txt pause
echo.
%starting% "FLIGHTGEAR-%bindate1%" /D%EXEFGFS1% /LOW fgrun.exe
sleep 4
cls
:: --------------------------------------------------
GOTO END
:: --------------------------------------------------
:start-fg2
del %status%
cls
if not exist C:\state\path-dsuad-Alpha2.txt goto input4
if not exist C:\state\home-PFF-Alpha2.txt goto input5
if not exist C:\state\sys32-BINdata2-Num.txt goto input6
goto next2
:: DUPLICATED NULL
:input4
color FC
%feedsnd%
echo %text17%
echo %text18%
echo %text19%
echo %text20%
echo %text21%
echo %text22%
echo.
set /P dsuad=Entering [docs, settings,] [USER\Application-Data] ROOT Path^>
echo.%dsuad%> C:\state\path-dsuad-Alpha2.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED NULL
:input5
%feedsnd%
cls
echo.
echo %text10%
echo %text11%
echo %text13%
echo %text14%
echo %text10%
echo.
set /P PFF=Entering THE [MAIN:[x\:Program Files Flightgear]ROOT FOLDER] Path^>
echo.%PFF%> C:\state\home-PFF-Alpha2.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED MULTI
:input6
%feedsnd%
cls
echo.
echo %text17%
echo %text30%
echo %text31%
echo %text22%
echo.
set /P sys32-BIN=Entering FGFSBIN Version Date: _________i.e.[v20101227] Path^>
echo.%sys32-BIN%> C:\state\sys32-BINdata2-Num.txt

cls
:: ----------------------------------------------------------------------
goto settings2
:next2
if not exist %state%\A-tm.txt color 17
:: ----------------------------------------------------------------------
if not exist "%path%\%fgsys2%" xcopy /s /h /y /k "%path%\%fgsys2%.bak" "%path%\%fgsys2%"
if not exist "%path%\%fgsys2%.bak" xcopy /a /s /h /y "%path%\%fgsys2%" "%path%\%fgsys2%.bak"
if exist "%path%\%fgsys2%\*" rename "%path%\%fgsys2%" %fgsys0%"
if not exist "%path%\%fgsys0%" md "%path%\%fgsys0%"
if not exist "%path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate2% fgrun.exe
echo %text100%
echo A2 > %state%\A2.txt
echo.%bindate2%> %status%
echo.
if exist %state%\A-tm.txt echo Path Being VERIFIED is %EXEFGFS2%
echo.
if exist %state%\A-tm.txt pause
echo.
%starting% "FLIGHTGEAR-%bindate2%" /D%EXEFGFS2% /LOW fgrun.exe
sleep 4
cls
:: --------------------------------------------------
GOTO END
:: --------------------------------------------------
:start-fg3
del %status%
cls
if not exist C:\state\path-dsuad-Alpha3.txt goto input7
if not exist C:\state\home-PFF-Alpha3.txt goto input8
if not exist C:\state\sys32-BINdata3-Num.txt goto input9
goto next3
:: DUPLICATED NULL
:input7
color FC
%feedsnd%
echo %text17%
echo %text18%
echo %text19%
echo %text20%
echo %text21%
echo %text22%
echo.
set /P dsuad=Entering [docs, settings,] [USER\Application-Data] ROOT Path^>
echo.%dsuad%> C:\state\path-dsuad-Alpha3.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED NULL
:input8
%feedsnd%
cls
echo.
echo %text10%
echo %text11%
echo %text13%
echo %text14%
echo %text10%
echo.
set /P PFF=Entering THE [MAIN:[x\:Program Files Flightgear]ROOT FOLDER] Path^>
echo.%PFF%> C:\state\home-PFF-Alpha3.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED MULTI
:input9
%feedsnd%
cls
echo.
echo %text17%
echo %text30%
echo %text31%
echo %text22%
echo.
set /P sys32-BIN=Entering FGFSBIN Version Date: _________ i.e. [v20101227] Path^>
echo.%sys32-BIN%> C:\state\sys32-BINdata3-Num.txt

cls
:: ----------------------------------------------------------------------
goto settings3
:next3
if not exist %state%\A-tm.txt color 17
:: ----------------------------------------------------------------------
if not exist "%path%\%fgsys3%" xcopy /s /h /y /k "%path%\%fgsys3%.bak" "%path%\%fgsys3%"
if not exist "%path%\%fgsys3%.bak" xcopy /a /s /h /y "%path%\%fgsys3%" "%path%\%fgsys3%.bak"
if exist "%path%\%fgsys3%*" rename "%path%\%fgsys3%" %fgsys0%"
if not exist "%path%\%fgsys0%" md "%path%\%fgsys0%"
if not exist "%path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate3% fgrun.exe
echo %text100%
echo A3 > %state%\A3.txt
echo.%bindate3%> %status%
echo.
if exist %state%\A-tm.txt echo Path Being VERIFIED is %EXEFGFS3%
echo.
if exist %state%\A-tm.txt pause
echo.
%starting% "FLIGHTGEAR-%bindate3%" /D%EXEFGFS3% /LOW fgrun.exe
sleep 4
cls
:: --------------------------------------------------
GOTO END
:: --------------------------------------------------
:start-fg4
del %status%
cls
if not exist C:\state\path-dsuad-Alpha4.txt goto input10
if not exist C:\state\home-PFF-Alpha4.txt goto input11
if not exist C:\state\sys32-BINdata4-Num.txt goto input12
goto next4
:: DUPLICATED NULL
:input10
color FC
%feedsnd%
echo %text17%
echo %text18%
echo %text19%
echo %text20%
echo %text21%
echo %text22%
echo.
set /P dsuad=Entering [docs, settings,] [USER\Application-Data] : ROOT Path^>
echo.%dsuad%> C:\state\path-dsuad-Alpha4.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED NULL
:input11
%feedsnd%
cls
echo.
echo %text10%
echo %text11%
echo %text13%
echo %text14%
echo %text10%
echo.
set /P PFF=Entering THE [MAIN:[x\:Program Files Flightgear]ROOT FOLDER] Path^>
echo.%PFF%> C:\state\home-PFF-Alpha4.txt
cls

:: ----------------------------------------------------------------------
:: DUPLICATED MULTI
:input12
%feedsnd%
cls
echo.
echo %text17%
echo %text30%
echo %text31%
echo %text22%
echo.
set /P sys32-BIN=Entering FGFSBIN FOLDER DATE: _________ i.e. [01012010] Path^>
echo.%sys32-BIN%> C:\state\sys32-BINdata4-Num.txt

cls
:: ----------------------------------------------------------------------
goto settings4
:next4
if not exist %state%\A-tm.txt color 17
:: ----------------------------------------------------------------------
if not exist "%path%\%fgsys4%" xcopy /s /h /y /k "%path%\%fgsys4%.bak" "%path%\%fgsys4%"
if not exist "%path%\%fgsys4%.bak" xcopy /a /s /h /y "%path%\%fgsys4%" "%path%\%fgsys4%.bak"
if exist "%path%\%fgsys4%\*" rename "%path%\%fgsys4%" %fgsys0%"
if not exist "%path%\%fgsys0%" md "%path%\%fgsys0%"
if not exist "%path%\%fgsys0%" goto error
echo starting "FLIGHTGEAR" Dated: %bindate4% fgrun.exe
echo %text100%
echo A4 > %state%\A4.txt
echo.%bindate4%> %status%
echo.
if exist %state%\A-tm.txt echo Path Being Verified is %EXEFGFS4%
echo.
if exist %state%\A-tm.txt pause
echo.
%starting% "FLIGHTGEAR-%bindate4%" /D%EXEFGFS4% /LOW fgrun.exe
sleep 4
cls
:: --------------------------------------------------
GOTO END
:: --------------------------------------------------
:error
start wizmo.exe play=error.wav volume=50
color 4f
cls
echo FATAL ERROR BAD PATH:
echo.
echo "%path%\%fgsys0%"
echo.
echo Most likely the folder normaly located at
echo C:\Documents and Settings\user\Application Data\flightgear.org
echo.
echo Also the backup does not exist or is named wrong!
echo or perhaps you have not properly configured this
echo batch file ? If you need help contact me on this
echo number +44(0)8458686711 This is my VOIP # Chelley
echo or email forums.chellejulie@virgin.net
echo.
pause
:abort
cls
echo ABORTING
sleep 2
cls
goto quit
:: --------------------------------------------------
:exists
start wizmo.exe play=error.wav volume=50
color 4f
cls
echo %text4%
echo A SYSTEM FOLDER CALLED flightgear.org
echo ALREADY EXISTS, as their is no FLAGGED
echo memory status of this folder it requires
echo human decision making.
echo.
echo IF THIS IS THE FIRST TIME YOU HAVE RUN THIS
echo BATCH FILE: simply rename flightgear.org
echo folder to flightgear.org.date-of-fgfs.exe
echo last used, i.e. flightgear.org.01012011
echo then change the values at :: SET BINDATE
echo to your date.
echo. i.e. [set bindate1=01012011]
echo %text4%
echo.
pause
cls
echo %text4%
echo IT HAS BEEN NOTED: Some older versions of
echo flightgear have different menu options in
echo FGRUN and as the cache is stored in the
echo system32 folders an older or newer version
echo of fgrun.prefs or autosave.xml can cause
echo odd results, even instability in flightgear
echo and that is the whole purpose of this batch
echo file to seperate the different versions.
echo %text4%
echo.
pause
cls
echo %text4%
echo OR maybe this batch file has been wrongly
echo configured? and is not working as it should
echo do, such as when the folders are locked by
echo the operating system ?
echo.
echo Which prevents this batch file from doing
echo renaming conventions on your flightgear.org
echo folders.
echo %text4%
echo.
pause
start explorer.exe "%path%\%fgsys0%"
cls
goto DONE
:: --------------------------------------------------
:status
%feedsnd%
cls
echo %text4%
echo Here are the status files for examination IF THEY EXIST!
echo It is a good sign if their are no [A*.txt] status files
echo after running this batch file via the [E] option as the
echo batch file is working ok, in so far it has not left an
echo un-tracked flightgear.org file in the system folder and
echo %text4%
echo When ready we can return to the choices Menu !!!
echo %text4%
echo.
sleep 5
start explorer.exe %state%
pause
cls
goto menu
:: --------------------------------------------------
:nochoice
start wizmo.exe play=error.wav volume=50
color 4f
cls
echo %text4%
echo It seems that CHOICE.COM did not work as expected
echo the options did not work please check your paths
echo and formatting of the batch file!
echo %text4%
pause
goto quit
:missing
color 4f
echo %text4%
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 ***************************************************
echo %text4%
pause
goto quit
:END
cls
echo %text4%
echo Flightgear %starting%
echo.
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 %text4%
echo Please DO NOT DELETE the A1,B2,C3, etc flags!
echo Stored in %state%
echo %text4%
echo.
if exist %state%\A-tm.txt echo While in test mode the Batch returns to START Until
if exist %state%\A-tm.txt echo you PRESS the QUIT option key! (Test Mode Resets)
sleep 15
if exist %state%\A-tm.txt goto start
cls
echo.
:DONE
cls
:quit


See More: Making my Batch smaller on certain VARIABLES

Report •

#1
June 20, 2011 at 07:57:51
✔ Best Answer
First, I strongly suggest using a variable name other than "path":

set /P path=...

%path% is a System Environment variable that represents the search order for
executables. Using it in batch can give unpredictable results.

<segue>
System Environment variables may help address your concerns! %APPDATA%
should represent the path to ?:\Documents and Settings\<some user>\Application Data.

To find other defined System Environment variables, open a command prompt and
issue the SET command with no arguments. This is what's listed when I do that
(personal information obfuscated with "..."):

ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=...
asl.log=Destination=file
CLASSPATH=.;E:\Program Files\Java\jre6\lib\ext\QTJava.zip
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=...
ComSpec=C:\WINDOWS\system32\cmd.exe
DEFAULT_CA_NR=CA100
Desktop=...
FP_NO_HOST_CHECK=NO
HOMEDRIVE=E:
HOMEPATH=...
LOGONSERVER=...
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Path;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\Common Files\Teleca Shared;\\Dl380-server\LAN Path\Test;\\DL380-SERVER\LAN Path;\\DL380-SERVER\LAN Path\exes;\\DL380-SERVER\LAN Path\Functions;\\DL380-SERVER\LAN Path\Tools;D:\Program Files\SlikSvn\bin;D:\Program Files\QuickTime\QTSystem;\\...\LAN Path;\\...\LAN Path\Exes;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\temp;D:\Program Files\Nmap
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 8, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0d08
ProgramFiles=C:\Program Files
PROMPT=$d$h$h$h$h$h$_$t$h$h$h$q$g
QTJAVA=E:\Program Files\Java\jre6\lib\ext\QTJava.zip
SESSIONNAME=Console
SVN_EDITOR="C:\Program Files\Notepad++\notepad++.exe"
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=...
TMP=...
USERDNSDOMAIN=DOMAIN.LOCAL
USERDOMAIN=DOMAIN
USERNAME=...
USERPROFILE=...
usrtmp=E:\Temp
windir=C:\WINDOWS

When your only tool is a hammer, every problem looks like a nail.


Report •

#2
June 20, 2011 at 10:33:37
Thank you Orangeboy I will make immediate amends to my %PATH% variable thanks for spotting y silly error, will now read the rest of your instructions :)

Michelle


Report •

#3
June 20, 2011 at 12:33:17
Dear Orangeboy,
I made those changes this is my DIFF report
ftp://xxxxx:xxxx@ortorea.dnsalias.org/FTP-Programs/FGFS-CHOICE-diff.htm (Only Viewable when my ftp is running)

Just checking to see if I missed anything now :)

Thanks, Michelle


Report •
Related Solutions


Ask Question