|
Answer» Ive got 40$ to the person who finishes this correctly first, on my honor!!
Create a text File called STUDENTS.TXT with "student roster" in the root directory
Instructions: Create a batch file BATCH1.BAT that requires the user to pass his first name through to the batch program when he runs it.
Batch1.BAT will call a second batch file called Register.BAT which will 1. ask the user to choose which of three classes he wants to register for class 1, class 2, class 3. 2. CHECK to see if he CHOSE class 1 a. if no, store a blank value in variable called ROSTER return to the calling program.
b. if yes, check to see if a directory called CLASS 1 exists. 1. if it does exist, delete it then recreate it. 2. if it doesnt exist, create it. 3. Once directory CLASS1 is created, store the users name in the variable ROSTER.
4. In Batch1.BAT, echo out to the screen the value stored in ROSTER
5. If the value is not a blank 1. Copy the file STUDENTS.TXT to the CLASS 1 subdirectory 2. Do a directory listing of the CLASS1 subdirectory, redirecting the listing to a file called LISTING.TXT END
I need BATCH1.BAT, REGISTER.BAT, and LISTING.TXT for my resultsRENTONTECHDUDE69!
Below the solution, it's a beauty! It assumes that the file STUDENTS.TXT is in the current directory, which should be the same as where the BAT files are per default.
BATCH1.BAT Code: [Select]@ECHO OFF SETLOCAL ENABLEEXTENSIONS
SET /p USER=Please enter your first name: CALL REGISTER.BAT ECHO.ROSTER=%ROSTER%
IF "%ROSTER%" NEQ "" ( COPY "STUDENTS.TXT" "%USERDIR%.\">NUL DIR "%USERDIR%.\">LISTING.TXT )
PAUSE REGISTER.BAT Code: [Select]@ECHO OFF
:menuLOOP SET ROSTER= echo. echo.= Register for a Class =============================== echo. for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C set choice= echo.&set /p choice=Make a choice or hit ENTER to continue: ||GOTO:EOF GOTO:menu_%choice% 2>NUL GOTO:menuLOOP
::----------------------------------------------------------- :: menu functions follow below here ::-----------------------------------------------------------
:menu_1 Class 1 SET USERDIR=CLASS 1 if exist "%USERDIR%.\" rd /s /Q "%USERDIR%.\" md "%USERDIR%.\"&&SET ROSTER=%USER% GOTO:EOF
:menu_2 Class 2 SET ROSTER= GOTO:EOF
:menu_3 Class 3 SET ROSTER= GOTO:EOF
LISTING.TXT Volume in drive C is HP_PAVILION Volume Serial Number is 0000-0000
Directory of C:\Web\bugs40\CLASS 1
04/22/2006 12:44 AM <DIR> . 04/22/2006 12:44 AM <DIR> .. 04/22/2006 12:40 AM 0 STUDENTS.TXT 1 File(s) 0 bytes 2 Dir(s) 88,322,592,768 bytes free
Keep your money, it was a pleasure come on... Is this a forum to help people, or to pay some workers which work for you. Why the *censored* should you be paid, DosItHelp :-? RENTONTECHDUDE69 - a thank you would be nice !!!! :-/Quote RENTONTECHDUDE69 - a thank you would be nice !!!! :-/ I don't think he will come back, and I don't think he would ever gave his moneyI guess you are right :-?"on my honor" eh?
Why is it that it's the people who say "truse me!" that you automatically want to trust the least?
|