xxxxxxxxxx
# Get the path of the folder you want to remove
$folderPath = "C:\path\to\folder"
# Check if the folder exists
if (Test-Path $folderPath) {
# Remove the folder recursively
Remove-Item -Path $folderPath -Recurse -Force
Write-Host "Folder removed successfully."
} else {
Write-Host "Folder does not exist."
}
xxxxxxxxxx
# Specify the folder path to be deleted
$folderPath = "C:\path\to\folder"
# Check if the folder exists
if (Test-Path $folderPath -PathType Container) {
# Remove the folder with all its contents forcefully
Remove-Item -Path $folderPath -Recurse -Force
Write-Host "Folder deleted successfully."
}
else {
Write-Host "Folder does not exist."
}
xxxxxxxxxx
// to delete a folder or file with windows powershell
Remove-Item <folder-name> or <file-name>
Remove-Item Test-Folder or Test.txt