Powershell script to delete a folder or directory if it exists:
$strFolderName="c:\temp\"
If (Test-Path $strFolderName){
Remove-Item $strFolderName
}
See Also:
Powershell: Check If File Exists
Powershell: Delete File if Exists
Test-Path
Remove-Item

great. how do i replace c:\temp with an enviroment variable. example %temp% or %tmp% like .bat/.cmd? thanks