Remove-Item * -Force -Recurse -Include name1,name2,name3 -ErrorAction SilentlyContinue
I haven't used it for a long time, but here it was needed. I run it - I didn't delete anything.
"WTF?" I think. He began to dig. I fiddled and fiddled, I went through everything, and the list was previously created, and the names changed - it still does not delete anything. In the end, I read in their dock: " Actually, -Include is buggy when used together with -Recurse, so use the crutch. ":
Because the Recurse parameter in Remove-Item has a known issue, the command in this example uses Get-ChildItem to get the desired files, and then uses the pipeline operator to pass them to Remove-Item.
Well, okay, I rewrote it using this crutch. One hell doesn't remove anything. Moreover, Get-ChildItem with -Include returns empty. Again, what I just didn’t do, as I didn’t distort with parameters, doesn’t work. The main thing is that it works with -Exclude , but nothing with -Include . I killed it all day: I thought that I had messed up somewhere in the parameters, that I had not taken into account some cunning nuance. And what happened in the end? I put them on PS7.1 - it worked. Even the first chuteless version using only Remove-Item worked in it. In general, it turned out to be their bug.
But having worn out with their Mighty Shell, I went to Google to read why their shell has such furious syntax. Mlyn, they position it as .NET for the console, but they don't even smell like C # syntax. Instead ...
In general, I came across this article: " What I Hate About PowerShell ". As the saying goes: "I couldn't agree more."
I suspect Mighty Shell's team is a bunch of Bash lovers.
- Let's finally make a Windows console in which it will be possible to write complex scripts. And then our cmd is outdated, so much so that we are already a little ashamed.
— ! ? VBScript, JScript. , .NET: C#, VB. , C# ? , C# . , .NET .
— , , , C#? bash! bash Windows. , bash , , 1960-. , , ! — ! . . , . ?