You may want to delete some files that are not important or useful anymore. PowerShell can help you do that job. You will obtain the specific steps to delete file PowerShell from this post of MiniTool.
When files or folders are taking up much space of your computer, which slows the running speed of your PC, you might want to delete them. When you don’t need a file or folder, you can also delete it.
In a word, you can execute the deletion operation according to your demand. There are multiple methods to do that job. For instance, you are able to delete the file or folder by putting it into the Recycle Bin, using Command Prompt or utilizing professional tools like MiniTool Partition Wizard.
When you cannot delete a file or folder from your PC, you should utilize some tools to do that operation by force. Read here, you may raise a question “How to Fore Delete a File That Cannot Be Deleted Windows 10”.
Today, I will introduce the Windows built-in utility – PowerShell, which can help you delete files and folders with ease. You have to open Windows PowerShell, identify the file/folder and use the removal command no matter you deleting files or folders.
Open the PowerShell by typing powershell in the search box and clicking on it. After that, follow the steps below to delete files or folders.
How to Delete File via PowerShell
There are some differences between deleting a single file and multiple files via PowerShell, but they also share some commons. Therefore, the PowerShell delete file part will be divided into two parts.
Command for Deleting a Single File on PowerShell
To delete a single file, you just need to type the following command and hit the Enter key. After that, the PowerShell remove-item command will take effect immediately.
Remove-item file-path
Command for Deleting Multiple Files on PowerShell
If you want to delete multiple files on your computer, you need to type the following command and hit Enter.
Remove-item file-path, file-path1, file-path2
You may notice that this command is very similar to the command to delete a single file, but there is a slight difference.
If you would like to delete files permanently with professional tools, you can refer to the guide.
How to Delete Folder via PowerShell
Similarly, the commands for deleting a single folder and multiple folders are also different. Now, let’s check them one by one.
Command for Deleting a Single Folder on PowerShell
To remove a folder via PowerShell, you need to type the command below in the prompt window and click on Enter.
Remove-Item folder-path
Command for Deleting Multiple Folders on PowerShell
Like deleting multiple files, the command for deleting multiple folders should include all the paths of the folders. You can type the following command and hit Enter to carry out the operation.
Remove-item C:Usersuser-nameDesktopTWC, C:Usersuser-nameDownloadsTWC1
Now, PowerShell delete file(s) and PowerShell delete folder(s) commands have been introduced to you. It’s your turn to make a choice.