0
0
PowerShellscripting~10 mins

Remove-Item in PowerShell - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to remove the file named 'test.txt'.

PowerShell
Remove-Item [1]
Drag options to blanks, or click blank then click option'
A'test.txt'
Btest.txt
C-Remove test.txt
D-Path test.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the file name.
Using incorrect parameters like -Remove.
2fill in blank
medium

Complete the code to remove all '.log' files in the current directory.

PowerShell
Remove-Item [1]
Drag options to blanks, or click blank then click option'
A'log*'
B'*log'
C'*.txt'
D'*.log'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong wildcard patterns like 'log*' or '*.txt'.
Not using quotes around the pattern.
3fill in blank
hard

Fix the error in the code to remove the directory 'Logs' and all its contents.

PowerShell
Remove-Item -Path 'Logs' [1]
Drag options to blanks, or click blank then click option'
A-Force
B-Recurse
C-Include
D-Filter
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Force alone does not remove contents recursively.
Using -Include or -Filter without -Recurse.
4fill in blank
hard

Fill both blanks to remove all hidden files in the 'Temp' folder.

PowerShell
Remove-Item -Path 'Temp\*' [1] [2]
Drag options to blanks, or click blank then click option'
A-Force
B-Recurse
C-Hidden
D-Verbose
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Recurse when not needed.
Forgetting -Force to remove hidden files.
5fill in blank
hard

Fill all three blanks to remove all '.tmp' files in 'C:\Data' and its subfolders, showing progress.

PowerShell
Remove-Item -Path 'C:\Data\*.tmp' [1] [2] [3]
Drag options to blanks, or click blank then click option'
A-Recurse
B-Verbose
C-Force
D-Confirm
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting -Recurse to remove files in subfolders.
Not using -Force to remove protected files.
Confusing -Confirm with -Verbose.