Windows Shell Scripting
I cannot find an example to follow along and set up this script. I keep running into a logfile error.
4. Check to see if a folder named “logfiles” exists in the C:Scripts folder. If it does not exist, create it.
5. Declare a variable called “dest” and set it to be equal to C:Scriptslogfilesuserinfo.log
6. Prompt the user to enter their name and store their name in a variable
7. Write the user’s name (that you just prompted them to enter) to the first line of userinfo.log (Important: if userinfo.log exists, you should overwrite the existing contents with their name in this step; however, for all other steps below make sure you append to the file so that you do not overwrite any information you have already written to the file)
8. Print a blank line to userinfo.log
9. Prompt the user to input a number between 1 and 9 and store it in a variable
10. If the user entered a number less than 5, print the statement “The number you entered, ‘num’, is a small number” to the file userinfo.log (replacing ‘num’ with the number they entered; otherwise, print the statement “The number you entered, ‘num’, is a large number” to the file userinfo.log (use an IF / ELSE statement to accomplish this)
11. Print another blank line to userinfo.log
12. Using an environment variable, determine which operating system the user’s computer is running and print a statement to userinfo.log that says “Your operating system is ‘OS'” (replacing ‘OS’ with the operating system you have read from the appropriate environment variable)
13. Print another blank line to userinfo.log
14. Using a FOR loop, write the names of all of the files in the Scripts directory ending with a .bat extension to userinfo.log