We help IT Professionals succeed at work.

Force Deletion Using PowerShell

Ray Turner
Ray Turner asked
on
129 Views
Last Modified: 2018-10-18
How do I delete a specific sub-folder in C:\Program Files (x86) using Windows PowerShell?  I want to delete the sub-folder and ALL of the child folders/files.
Comment
Watch Question

Simple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
The double quotes need to enclose the path:
remove-item 'c:\program files (x86)\whatever' -recurse -force

Open in new window

I've also changed to ticks to prevent PowerShell from trying to accidentally detect an expression in the string.
Ray TurnerSenior Consultant

Author

Commented:
Thanks a lot!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.