Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to copy a file from source to destination.
PowerShell
Copy-Item -Path 'C:\source\file.txt' -Destination [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same path for source and destination, which does nothing.
Forgetting to put the path in quotes.
✗ Incorrect
The destination path must be different from the source to copy the file to a new location.
2fill in blank
mediumComplete the code to move a file to a new folder.
PowerShell
Move-Item -Path 'C:\docs\report.docx' -Destination [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same path for source and destination.
Not specifying the filename in the destination path.
✗ Incorrect
The destination path should be the new location where the file will be moved.
3fill in blank
hardFix the error in the code to copy all text files from one folder to another.
PowerShell
Copy-Item -Path 'C:\data\*.txt' -Destination [1] -Recurse
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a destination path with trailing backslash causing errors.
Not specifying the destination folder correctly.
✗ Incorrect
The destination path should be a folder path without trailing backslash to avoid errors in some PowerShell versions.
4fill in blank
hardFill both blanks to move all .log files from source to archive folder and overwrite existing files.
PowerShell
Move-Item -Path 'C:\logs\*.log' -Destination [1] -[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong folder path for destination.
Forgetting to add the Force parameter to overwrite.
✗ Incorrect
The destination is the archive folder path, and the Force parameter allows overwriting existing files.
5fill in blank
hardFill all three blanks to copy all .csv files from source to backup folder, including subfolders, and preserve the directory structure.
PowerShell
Copy-Item -Path 'C:\data\*.csv' -Destination [1] -[2] -[3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using Recurse to copy subfolders.
Not using Container to preserve folder structure.
✗ Incorrect
The destination is the backup folder, Recurse copies subfolders, and Container preserves the folder structure.