Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. Create a batch file named hide.bat. The batch file must use the attrib command to hide files. The file
  2. name(s) of the file(s) to be hidden must be passed to the batch file by the user at the time the batch file is
  3. executed (replaceable parameters)
  4.  
  5.  The batch file must be able to handle multiple parameters entered by the user. In other
  6. words, it should allow the user to enter more than one file name. (i.e, Hide File1.txt
  7. file2.txt file3.txt)
  8.  
  9.  You must use the SHIFT command and looping
  10.  
  11.  You must include the logic that will allow the loop to end on its own when there are no
  12. parameters left to process
  13.  
  14.  You must include the logic that will display an error message if the user attempts to run
  15. the batch file without entering a parameter
  16.  
  17.  Messages must be appropriately formatted.
  18.  
  19.  Before hiding the file the batch file should confirm that it exists. If the file doesn’t exist,
  20. the attrib command shouldn’t be executed.
  21.  
  22.  Two logs should be kept a hidden.log file and an error.log file. Each time a file is
  23. successfully hidden, a message should be stored in the hidden.log file. The message must
  24. identify the file name (including its absolute path) of the file that was successfully
  25. hidden. Each time a file is not successfully hidden (because it didn’t exist), a message
  26. should be stored in the error.log file. The message must identify the file name of the file
  27. that didn’t exist.
  28.  
  29.  At the completion of the batch file, the content of each log file must be displayed on the
  30. screen with an appropriate heading; i.e., The following files were hidden; The following
  31. files were not hidden because they didn’t exist. NO output should be displayed on the
  32. screen while the batch file is running – all output should be sent to the log files and each
  33. log file’s contents must be displayed when the batch file ends.
  34.  
  35.  After displaying the log files, they should be deleted.
  36.  
  37.  Before displaying and/or deleting each of the log files, make sure they exist; if they don’t
  38. exist, don’t display and/or delete them.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement