Recall & Review
beginner
What does the PowerShell cmdlet <code>Copy-Item</code> do?It copies files or folders from one location to another, similar to copying a file on your computer.
Click to reveal answer
beginner
What is the difference between
Copy-Item and Move-Item?Copy-Item duplicates the file or folder, leaving the original intact. Move-Item transfers the file or folder to a new location and removes it from the original place.Click to reveal answer
beginner
How do you copy a file named
report.txt from C:\Docs to D:\Backup using PowerShell?Use the command: <br>
Copy-Item -Path 'C:\Docs\report.txt' -Destination 'D:\Backup'Click to reveal answer
intermediate
What happens if you use
Move-Item to move a file to a folder that already has a file with the same name?PowerShell will overwrite the existing file without warning, replacing it with the moved file.
Click to reveal answer
intermediate
How can you copy all files from one folder to another, including subfolders, using
Copy-Item?Use the
-Recurse parameter: <br>Copy-Item -Path 'C:\SourceFolder\*' -Destination 'D:\TargetFolder' -RecurseClick to reveal answer
What parameter do you use with
Copy-Item to include all subfolders?✗ Incorrect
The
-Recurse parameter tells PowerShell to copy all files and folders inside subfolders.Which cmdlet would you use to move a file instead of copying it?
✗ Incorrect
Move-Item moves files or folders to a new location, removing them from the original place.If you want to copy a file but keep the original, which cmdlet should you use?
✗ Incorrect
Copy-Item duplicates the file, so the original stays where it is.What happens if you move a file to a location where a file with the same name exists?
✗ Incorrect
By default,
Move-Item overwrites files with the same name without asking.How do you specify the source file in
Copy-Item?✗ Incorrect
The
-Path parameter specifies the file or folder to copy.Explain how to copy a folder and all its contents to a new location using PowerShell.
Think about copying everything inside the folder, not just the folder itself.
You got /4 concepts.
Describe the difference between copying and moving files in PowerShell and when you might use each.
Consider what happens to the original file in each case.
You got /4 concepts.