Menu

Practice questions: Files and folders

Pick an answer and press "Check answer" to see right away whether you got it. If you are unsure, open "Read the article" to review the command and then try again. Questions you answer correctly are remembered in this browser.

27 questions Solved 0 / 27

assoc / ftype - File Associations

Read the article →

assoc / ftype - File Associations — Question 1

Which statement about assoc and ftype is correct?

Choose one answer.

  1. assoc handles the file type to command mapping, and ftype handles the extension to file type mapping
  2. assoc handles the extension to file type mapping, and ftype handles the file type to command mapping
  3. Both link an extension directly to a command

assoc / ftype - File Associations — Question 2

Which command deletes the association for .log?

Choose one answer.

  1. assoc .log
  2. assoc .log=txtfile
  3. assoc .log=

attrib - Change file attributes

Read the article →

attrib - Change file attributes — Question 1

Which command makes document.txt read-only?

Choose one answer.

  1. attrib +r document.txt
  2. attrib -r document.txt
  3. attrib +h document.txt

attrib - Change file attributes — Question 2

Which command clears the hidden attribute from all .txt files in the current folder and its subfolders?

Choose one answer.

  1. attrib -h *.txt
  2. attrib -h *.txt /s
  3. attrib -h *.txt /d

copy - File Copying

Read the article →

copy - File Copying — Question 1

Which is the correct way to duplicate file1.txt as file2.txt?

Choose one answer.

  1. copy file1.txt file2.txt
  2. copy /source file1.txt /destination file2.txt
  3. copy file1.txt > file2.txt

copy - File Copying — Question 2

Which option skips the overwrite confirmation for an existing file?

Choose one answer.

  1. copy /y
  2. copy /a
  3. copy /z

del/erase - Delete files

Read the article →

del/erase - Delete files — Question 1

Which command displays a confirmation message before deleting?

Choose one answer.

  1. del sample.txt
  2. del /p sample.txt
  3. del /q sample.txt

FORFILES - Process Files in Bulk

Read the article →

FORFILES - Process Files in Bulk — Question 1

Which command lists files that were last modified 30 or more days ago?

Choose one answer.

  1. forfiles /D 30 /C "cmd /c echo @file"
  2. forfiles /D -30 /C "cmd /c echo @file"
  3. forfiles /M -30 /C "cmd /c echo @file"

FORFILES - Process Files in Bulk — Question 2

Why do you add cmd /c when running echo or del with /C in FORFILES?

Choose one answer.

  1. Internal commands are started as a separate process, so cmd /c is required
  2. echo cannot run without administrator privileges
  3. Without cmd /c, the file name is not displayed

FORFILES - Process Files in Bulk — Question 3

What should you do first, for safety, when deleting old files with FORFILES?

Choose one answer.

  1. Run it with del @path from the start
  2. First display the targets with echo @path and check them, then replace it with del
  3. Running without /S is safe, so no check is needed

icacls - View and Change Permissions

Read the article →

icacls - View and Change Permissions — Question 1

Which command gives the signed-in user full control over the C:\work folder and the files and subfolders inside it?

Choose one answer.

  1. icacls “C:\work” /grant “%USERNAME%:F”
  2. icacls “C:\work” /grant “%USERNAME%:(OI)(CI)F”
  3. takeown /f “C:\work”
Read the article →

mklink - Create Links — Question 1

mklink - Create Links — Question 2

move - Move files and folders

Read the article →

move - Move files and folders — Question 1

The following command was used to move a folder.

move from to

What happens if there is already a folder named to?

Choose one answer.

  1. A confirmation message for overwriting is displayed
  2. The name of the source folder is used as the name of the destination folder
  3. The from folder is moved into the to folder
  4. An error occurs

pushd, popd — Question 1

What happens when you run popd after pushd \\server\share?

Choose one answer.

  1. You return to the folder you were in before pushd, and the assigned drive letter is released
  2. The network connection is dropped and you stay where you are
  3. You move up one folder

rd/rmdir - Delete a folder

Read the article →

rd/rmdir - Delete a folder — Question 1

When deleting a folder containing multiple files in a batch file, select the command that will delete the folder and all files in it without stopping subsequent processing.

Choose one answer.

  1. rmdir %userprofile%\documents\disposable
  2. rmdir /s %userprofile%\documents\disposable
  3. rmdir /s /q %userprofile%\documents\disposable

robocopy - Advanced Copy

Read the article →

robocopy - Advanced Copy — Question 1

Which statement about judging robocopy exit codes is generally correct?

Choose one answer.

  1. 0-3 is success, 4 or higher is an error
  2. Only 0 is success; 1 or higher is always an error
  3. 0-7 is not a failure, 8 or higher is an error

subst - Assign a Folder to a Drive

Read the article →

subst - Assign a Folder to a Drive — Question 1

Which command removes the folder assigned to X: as a virtual drive?

Choose one answer.

  1. subst X: /r
  2. subst X: /d
  3. del X:

subst - Assign a Folder to a Drive — Question 2

Which statement about a virtual drive created with subst is correct?

Choose one answer.

  1. The assignment is kept after a restart
  2. The assignment is removed on restart or sign-out
  3. A network share (UNC path) can be specified directly

TAR - Compress and Extract

Read the article →

TAR - Compress and Extract — Question 1

Which command compresses the docs folder into a ZIP file named backup.zip?

Choose one answer.

  1. tar -a -c -f backup.zip docs
  2. tar -x -f backup.zip docs
  3. tar -t -f backup.zip docs

TAR - Compress and Extract — Question 2

What happens when you run tar -x -f backup.zip -C D:\Work\restore and D:\Work\restore does not exist?

Choose one answer.

  1. An error occurs if the destination folder does not exist
  2. The destination folder is created automatically
  3. If the destination folder does not exist, the files are extracted into the current directory

tree - Display Directory Structure

Read the article →

tree - Display Directory Structure — Question 1

Which option also displays file names in each folder, not just directories?

Choose one answer.

  1. tree /F
  2. tree /A
  3. tree /D

tree - Display Directory Structure — Question 2

Which command is most appropriate for a tree that includes files and uses ASCII characters?

Choose one answer.

  1. tree /L 2
  2. tree /A
  3. tree /F /A

WHERE - Find Executables

Read the article →

WHERE - Find Executables — Question 1

Which is a correct way to check in a batch file whether a command is available (on the PATH)?

Choose one answer.

  1. Run where /Q command_name and check ERRORLEVEL
  2. Run where /E command_name
  3. Run where /CHECK command_name

xcopy - Advanced File Copy

Read the article →

xcopy - Advanced File Copy — Question 1

Choose the correct command to copy a whole directory, including empty subdirectories.

Choose one answer.

  1. xcopy Source Destination
  2. xcopy Source Destination /s
  3. xcopy Source Destination /s /e
  4. xcopy Source Destination /e

xcopy - Advanced File Copy — Question 2

Which option copies only files changed since the last backup (incremental backup)?

Choose one answer.

  1. xcopy Source Destination /s /u
  2. xcopy Source Destination /s /d
  3. xcopy Source Destination /s /i
  4. xcopy Source Destination /s /k

xcopy - Advanced File Copy — Question 3

Which option only displays the list of files that would be copied, without actually copying them?

Choose one answer.

  1. /q
  2. /f
  3. /l
  4. /v

Other topics

← Back to all practice questions