Question

Create a Windows batch script. The batch script will contain the following: Ask the user interactively:...

Create a Windows batch script. The batch script will contain the following:

  1. Ask the user interactively:
    1. Boot drive letter of the computer
    2. Computer name
    3. Computer Model
  2. Check to see if the boot drive in #1 exists with the folder newfolder (#1 above)
    1. If yes cd BootDrive\newfolder
    2. If no, make the directory BootDrive\newfolder
  3. Check to see if casefile.txt exists:
    1. If yes goto the label DONE
    2. Tell the user that data already exists in the newfolder folder and exit the program
  4. Output the variables in #1 to the file BootDrive\newfolder\casefile.txt (#1 above)
  5. Execute the correct commands redirecting output to command-name.txt in BootDrive\newfolder in order to get the output below:
    1. Environment variable
    2. System information
    3. Mac address (You cannot use the ipconfig command)
    4. DNS table
    5. Export the system.evtx file to BootDrive\newfolder\sys.evtx
  6. Use a FOR loop to:
    1. Execute hostname and send the output to a variable host
    2. Output the variable host to BootDrive\newfolder\casefile\host.txt
  7. Use an if statement to determine if sys.evtx exists (from #4)
    1. If sys.evtx exists echo sys.evtx successfully created
0 0
Add a comment Improve this question Transcribed image text
Answer #1

@echo off
set /p bd=Enter the Boot drive letter of the computer.
echo %bd%
set /p cn=Enter the computer name.
echo %cn%
set /p mdl=Enter the model.
echo %mdl%
IF EXIST "%bd%\newfolder" (cd %bd%\newfolder)
ELSE (mkdir %bd%\newfolder)
IF EXIST "%bd%\newfolder\casefile.txt" GoTo DONE
echo !bt! > "%bd%\newfolder\casefile.txt"
echo $Env:"%bd%\newfolder\casefile.txt"
systeminfo
for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i "Physical Host"') do (
echo %%i >> \\server1\folder1\folder2\macadd%random%.txt
)
nslookup localhost 2>nul | find "Address:"
xcopy "c:\system.evtx" "%bd%\newfolder\casefile.txt"
for /f %%a in ('hostname') do (
md %%a
echo !a! > "%bd%\newfolder\casefile\host.txt"
)
IF EXIST "C:\windows\system32\winevt\Logs\sys.evtx" echo sys.evtx successfully created
:DONE
echo data already exists in the newfolder
pause

Add a comment
Know the answer?
Add Answer to:
Create a Windows batch script. The batch script will contain the following: Ask the user interactively:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a Windows batch script that: Execute the correct commands redirecting output to command-name.txt in BootDrive\newfolder2...

    Create a Windows batch script that: Execute the correct commands redirecting output to command-name.txt in BootDrive\newfolder2 in order to get the output below: Environment variable System information Mac address (You cannot use the ipconfig command) DNS table Export the system.evtx file to BootDrive\newfolder2\sys.evtx Use a FOR loop to: Execute hostname and send the output to a variable host Output the variable host to BootDrive\newfolder2\casefile\host.txt Use an if statement to determine if sys.evtx exists (from #4) If sys.evtx exists echo sys.evtx...

  • Question: Hands-On Project 3-3 Use a Batch File A file with a bat file extension is...

    Question: Hands-On Project 3-3 Use a Batch File A file with a bat file extension is called a batch file. Yo... Use a Batch File A file with a .bat file extension is called a batch file. You can use a batch file to execute a group of commands, sometimes called a script, from a command prompt. Do the following to learn to use a batch file: 1. Using a command prompt window, copy the files in your Documents folder...

  • Problem 1 Write a BASH script to create a user account from the Linux system on...

    Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...

  • Copy/Paste your script from 5b here. 4. Let's look at a more complicated script executable. a....

    Copy/Paste your script from 5b here. 4. Let's look at a more complicated script executable. a. Write the following as script6.sh and change its permissions to count for num in d do if num eq 100 then count (count+1) done echo The number 10 was found $count times What is the output? Run the script as ./script6.sh 10 20 30 10 40 20 50 10 60 <enter Summarize what the script does r using the read command. The following script...

  • Please write a BASH Script in LINUX that... 1. is actually executable 2. has a comment...

    Please write a BASH Script in LINUX that... 1. is actually executable 2. has a comment to tell us what you did, why and how. 3. allows a user to enter their name and a number between 1 than 100 (this must be prompted so the user knows what to do) 4. creates a random number between 1 and 100 for you to guess. The command to create a random number is shown below. (if you find a better one...use...

  • Edit a C program based on the surface code(which is after the question's instruction.) that will...

    Edit a C program based on the surface code(which is after the question's instruction.) that will implement a customer waiting list that might be used by a restaurant. Use the base code to finish the project. When people want to be seated in the restaurant, they give their name and group size to the host/hostess and then wait until those in front of them have been seated. The program must use a linked list to implement the queue-like data structure....

  • Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around...

    Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around risk and threat management, fostering an environment in which objectives seem clear: manage risk, manage threat, stop attacks, identify attackers. These objectives aren't wrong, but they are fundamentally misleading.In this session we'll examine the state of the information security industry in order to understand how the current climate fails to address the true needs of the business. We'll use those lessons as a foundation...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT