Lab Activity 07 - Batch File_v2

docx

School

Central Georgia Technical College *

*We aren’t endorsed by this school

Course

CST8101

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

9

Uploaded by ConstableEagleMaster1008

Report
Lab Activity 07 CST8101 Computer Essentials Version W2023 Due date Complete your demonstration on or before the due date: Lab Section 301 Tuesday April 11 th Lab Section 302 Wednesday April 12 th Lab Section 303 Monday April 10 th Lab Section 304 Monday April 10 th If you miss the demonstration this lab activity becomes zero. Evaluation 1 Mark Materials BYOD College approved laptop Windows 10 or 11 Procedure In part 1, you are going to type various commands to see what they do. Your lab instructor is not going to check your Part 1. There will also be questions about Part 1 on the final exam. The commands will also help you in Part 2, of this assignment. Start the Windows Command Prompt and type in the following commands to see what they do. Part 1: Exercise #1 : Command: CD 1) Type in: CD /? 2) Read the help pages for the cd command. What is the purpose/output of cd command? __CD Displays the name of or changes the current directory._____________________________________________________ Exercise #2 : command cd.. Type the following command and press Enter 1) Type in: cd.. /? 2) Read the help pages for the cd.. command. What is the purpose/output of cd.. command? ©Algonquin College November 30, 2023 Page 1 of 9
Lab Activity 07 CST8101 Computer Essentials Version W2023 3) __Displays the name of or changes the current directory, Specifies that you want to change to the parent directory_____________________________________________________ Exercise #3 : command dir Type the following command and press Enter 1) Type in: dir /? 2) Read the help pages for the dir command. What is the purpose/output of dir command? __ Volume in drive C is Windows Volume Serial Number is BE84-2F6B_ Exercise #4 : command whoami Type the following command and press Enter 1) Type in: whoami /? 2) Read the help pages for the whoami command. What is the purpose/output of whoami command? __show the name of laptop: laptop-rolvh3tt\zhenz____________________ Exercise #5 : command cls Type the following command and press Enter 1) Type in: cls /? 2) Read the help pages for the cls command. What is the purpose/output of cls command? ____Clears the screen.____________________ Exercise #6 : command echo Type the following command and press Enter 1) Type in: echo /? 2) Read the help pages for the echo command. What is the purpose/output of echo command? ©Algonquin College November 30, 2023 Page 2 of 9
Lab Activity 07 CST8101 Computer Essentials Version W2023 ___Type ECHO without parameters to display the current echo setting.________ ©Algonquin College November 30, 2023 Page 3 of 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab Activity 07 CST8101 Computer Essentials Version W2023 Exercise #7 : command exit Type the following command and press Enter 1) Type in: exit /? 2) Read the help pages for the echo command. What is the purpose/output of exit command? __Quits the CMD.EXE program (command interpreter) or the current batch script_ Exercise #8 : command net Type the following command and press Enter 1) Type in: net /? 2) Read the help pages for the net command. What is the purpose/output of net command? 3) ________________ Exercise #9 command ipconfig Type the following command and press Enter 1) Type in: ipconfig /? 2) Read the help pages for the ipconfig command. What is the purpose/output of the ipconfig command? ©Algonquin College November 30, 2023 Page 4 of 9
Lab Activity 07 CST8101 Computer Essentials Version W2023 __________ Exercise #10 command type Type the following command and press Enter 1) Type in: type /? 2) Read the help pages for the type command. What is the purpose/output of the type command? ___ Displays the contents of a text file._____________ ©Algonquin College November 30, 2023 Page 5 of 9
Lab Activity 07 CST8101 Computer Essentials Version W2023 Exercise #11 command set Type the following command and press Enter 1) Type in: set /? 2) Read the help pages for the set command. What is the purpose/output of the set command? 3) __Displays, sets, or removes cmd.exe environment variables._______________ Exercise #12 command set Type the following command and press Enter 1) Type in: systeminfo /? 2) Read the help pages for the systeminfo command. What is the purpose/output of the systeminfo command? 3) _This tool displays operating system configuration information for a local or re- mote machine, including service pack levels.______ Part 2 : Writing a Sample Batch Program. Refer to the lecture materials for help with this part of the lab, additional help will be provided in the lecture period . Batch files are used to automate everyday tasks such as helping a computer technician, network administrator, or a computer programmer diagnose a networking issue or shorten the time it takes to everyday tasks such as compile Java programs. Procedure: The first part is to create a batch file allows you to test your network adaptor and see if you are connected to a network. There are seven simple commands I want to familiarize you with for this program. Com- mands are NOT case sensitive. TITLE - The Window name for the BAT file. ECHO - the “print” statement for BAT files. Anything following the word ECHO will be displayed in the command prompt as text, on its own line. ECHO OFF – BATCH FILE writers typically put this at the beginning of their files. It means that the program won’t show the command that you told it to run while it’s run- ning – it’ll just run the command. I’d recommend that after you run this test program, you try removing this line from your code to see what happens. ©Algonquin College November 30, 2023 Page 6 of 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab Activity 07 CST8101 Computer Essentials Version W2023 PAUSE - This output the “ press any key to continue… ” message that you’ve seen all too many times. It’s helpful because it pauses the batch file execution. If you don’t put this in your program, everything will speed by and end before you can see it. Programmers typi- cally put this in batch files to give the user a chance to review the material on the screen before continuing. CLS - Clears the CMD window IPCONFIG – Outputs network information into your CMD box WHOAMI - This utility can be used to get user name and group information along with the respective security identifiers (SID), claims, privileges, logon identifier (logon ID) for the current user on the local system. SET – Sets a variable. If you want to see what the content of a variable, use the echo command. With the /p switch you can instruct set to create a new variable based on the users input. IF – The IF command ties together batch processing. The IF command responds to the variable created by the set command. GOTO – The GOTO command tells the command prompt to jump to a new location in the batch file. Create a new text document on your text desktop. Double click the file – it should be blank inside. Now, go to file>save as , and in the “ Save As ” window, input a name for your BAT file and then add a .bat on the end. For example, when I created the batch file below I named it lab7 .bat. Right click your BAT file and click “ edit ” to bring up Notepad and create the batch file. The batch file should have a menu that allows the user seven options. The batch file should run until the user chooses to quit the batch file [space] means press the spacebar once Option 1: allows the user to test their network adaptor to see if it is running. The com- mand is: ping 127.0.0.1 Option 2: allows the user to run the ipconfig command. The command is: ipconfig Option 3: allows the user to release their current IP address for their adaptor. The com- mand is: ipconfig [space]/release ©Algonquin College November 30, 2023 Page 7 of 9
Lab Activity 07 CST8101 Computer Essentials Version W2023 Option 4: allows the user to renew their adaptor’s IP address. The command to do this is ipconfig[space]/renew Option 5: allows the user to remove all entries from their DNS cache i.e. to flush the cache. The command to do is ipconfig[space]/flushdns Option 6: allows the user to stop the print spooler. The command to stop the print spooler is net stop spooler. Option 7: allows the user to start the print spooler. The command to start the spooler is: net start spooler. Option 8: allows the user to run the whoami command and their display their user id and SID. The command is: whoami [space]/user. Option 9: allows the user to press q to stop the batch file from running. Once you have completed the lab; demonstrate your batch file to your lab instructor. ©Algonquin College November 30, 2023 Page 8 of 9
Lab Activity 07 CST8101 Computer Essentials Version W2023 CST8101 Sign off sheet Print this sheet and bring it to your lab period when you demo your lab. Lab Section number: __________________________________ Print your full name: __________________________________ Marking Guide: 1 Marks (1) Student demonstrated the batch file in the lab period. (0) Student did not demonstrate the batch file. Total Lab Instructor Signature: _____________________________________________ ©Algonquin College November 30, 2023 Page 9 of 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help