Vidyalelo
Computer Science · Q97

Disk Operating System (DOS)

Engineering and GATE · Computer Science · question 97

Q97

While working with MS-DOS, which command is used to rename a file named file1.doc to file2.doc from a different directory called dir1?

A.
Ren2.doc \dir\file1.doc
B.
Ren file1.doc file2.doc
C.
Ren .doc\dir\.doc
D.
Ren \dir1\file1.doc file2.doc
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
To rename a file named file1.doc to file2.doc from a different directory dir1 in MS-DOS, you use the ren (short for rename) command. Here’s the explanation for each option:
Option A: Ren2.doc \dir\file1.doc is incorrect syntax. The correct format for renaming involves specifying the full path of the original file followed by the new filename.
Option B: Ren file1.doc file2.doc renames file1.doc to file2.doc in the current directory, not in a different directory.
Option C: Ren .doc\dir\.doc is incorrect syntax. It does not specify the correct path or filenames for renaming.
Option D: Ren \dir1\file1.doc file2.doc is the correct command to rename file1.doc located in directory dir1 to file2.doc.

Therefore, Option D is the correct command to rename a file from a different directory in MS-DOS.