DOS command using Notepad submission deadline Part 2: Review the information ava
ID: 3888581 • Letter: D
Question
DOS command using Notepadsubmission deadline Part 2: Review the information available at http:/lwww.wikihow comWrite-a-Batch-File and similar websites. Watch the video available at https.lyoutu belPy9aEbnioYO to see a demonstration of how your batch script should appear to an end-user ignore the reference to COS 430) Now, create a MS-DOS Command Shell (batch) script that demonstrates your ability to use the cls, echo, rem, attrib, if, and pause commands and access command parameters to get the computer to · clear the screen . turn echo off create three files (file1.txt", "file2 txt", and "file3 txt") in the same folder/directory as the batch file when executed Each file must contain just one line of text this is filen (where: n is the file number) display the file attribs of each of these file "Before the change based on the parameter supplied at the DOS prompt (either "+ or "-a") when the batch file is executed must either set the "read-only" file attrib of each file (in the case the parameter is +") or set the "do not archive" file attrib of each file (in the case the parameter is"-a") display the file attribs of each of these file "After the change pause to alow the user to see the output and then press a key to complete execution of the script Save the script as a "batch file (i.e, has a "bat" file extension"). Because batch (bat) files can be crafted for malicious purposes they are often blocked when transported over the Internet Please change the file extention from bat" to dat if you encounter any problems uploading the file during HMWK submission
Explanation / Answer
cls
@echo off
rem create the files
for /L %%x in (1, 1, 3 ) do (
echo this is the file %%x > file%%x.txt
)
rem view attributes of the files
for /L %%y in (1, 1, 3 ) do (
attrib file%%y.txt
)
rem set attributes of the files
for /L %%z in (1, 1, 3 ) do (
if %1%=="+r" (attrib +r file%%z.txt)
if %1%=="-a" (attrib -a file%%z.txt)
)
rem view the new attributes of the files
for /L %%y in (1, 1, 3 ) do (
attrib file%%y.txt
)
pause
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.