Things get better – Remove-Item -reCURSE

Those who dont learn history are bound to repeat it. I know Remove-Item -Recurse was broken.. I know it has been fixed.. I still forget it on old systems sometimes.

If you are running Windows 2008R2 or older system and want to remove directories using powershell well Remove-Item -Recurse might sound smart but wait.. There is a little problem with that cmdlet.

Well Microsoft has fixed that with Windows 2012.  But I still sometimes need to script on older systems, its easy to forget that its broken. If I run the same command on a Windows 2012 or 2012R2 Preview I get the following:

So its better at least.. Im happy.

Things used to be so much easier in 1993 Microsoft released MS-DOS 6.0.. Those were the times, a new command called deltree.exe were released and all lived happily ever after. That might have been true, Microsoft have removed deltree.exe from Windows after migrating the function into the del command.

So remember if cant be sure of which Windows your powershell will be running you cant depend on Remove-Item -recurse

 

Leave a Reply