Protecting files from modification in DOS: Which command makes the file CBT.EXE read-only to prevent subsequent changes?
-
ARENAME +r CBT.EXE
-
BATTRIB +R CBT.EXE
-
CCOPY +r CBT.EXE
-
DMODE +r CBT.EXE
-
ENone of the above
Answer
Correct Answer: ATTRIB +R CBT.EXE
Explanation
Introduction / Context:DOS file attributes control visibility and mutability. Setting the read-only attribute prevents edits and overwrites by many utilities. Technicians frequently toggle attributes to protect executables and configuration files.
Given Data / Assumptions:
- The file is CBT.EXE in the current directory.
- We want to prevent changes by setting read-only.
- DOS provides ATTRIB to manage file attributes (Read-only, Archive, System, Hidden).
Concept / Approach:
ATTRIB accepts +R to add the read-only attribute and -R to remove it. Once set, typical copy or editor operations will prompt or fail to overwrite unless attributes are cleared or forced by specialized tools.
Step-by-Step Solution:
Use the attribute utility: ATTRIB.Add the read-only flag: +R.Specify the target file: CBT.EXE.Run: ATTRIB +R CBT.EXE.Verification / Alternative check:
Issue ATTRIB CBT.EXE after the command to display current attributes and confirm the R flag is set. Attempting to overwrite will now typically produce an access denied or confirmation prompt.
Why Other Options Are Wrong:
- RENAME +r, COPY +r, MODE +r: These commands do not set attributes and the syntax is invalid in this context.
- None of the above: Incorrect because ATTRIB +R is correct.
Common Pitfalls:
Forgetting to remove the attribute when updating the file (use ATTRIB -R CBT.EXE). Also, note that some installers override attributes; verify after updates.
Final Answer:
ATTRIB +R CBT.EXE