PowerShell

Is it worth learning for the average user?

I use winget and a script that I barely have to use to install and uninstall certain programs on clean installs.

Attached: cursos-online-powershell.png (1000x544, 74.85K)

PowerShell like all Microsoft products was designed (perhaps unintentionally) to waste the maximum amount of the user's time.

I've been looking for a good resource for learning PS during downtime at work (I work plastics, not IT). Any suggestions?

Lol probably a video? Lets stop pretending this is rocket science, its just a fucking terminal user learn the commands then go from there should take max a week if not less

>Is it worth learning for the average user?
no

I used to think so when I worked as a sysadmin managing hundreds of windows machines. It's useful for win specific tasks, but for general scripting and automation there's like 5 other languages I'd use first

HolyC is PowerShell but good. Learn that instead.

Everyone who replied so far has evidently never used it.
Simply put it's not worth learning for the "average" user, but neither is any shell.
If you're someone who is:
a. comfortable in a terminal
b. familiar with shells in general
c. frequently working on Windows
Then yes I'd say powershell is worth learning.
t. Has used PowerShell as primary shell for 2 years now

i use powershell for exchange and AD related stuff. for a windows sysadmin it's essential.

Just for a taste, how would you do something like this in Powershell?
for x in ls ./*.txt
do
cp "$x"{,.bak}
done

PowerShell for Sysadmin if you want a good, quick primer and real examples

PowerShell in a Month of Lunches if you want to be really god at it

PowerShell Master Class on YT is another great resource.

>He doesn't know what an object is
Oof.

Winget is mostly pointless since it’s all still installers. Power shell is pretty great especially since it’s cross platform now but if you’re not goin to do a lot with it and you already know another shell scripting language it’s probably not worth your time (unless you’re familiar with lent in which case it may be)

PowerShell is the worst language I have ever learned and used but if you're using Windows it's not like you have a choice. Being able to interop with .NET is neat but it's just packaged in such an absolutely horrid way.

NTA but
Get-ChildItem "*.txt" | Copy-Item -Destination { "$($_.Name).bak" }

>frequently working on windows
No. It’s cross platform

Yes you do have a choice, WSL
It is certainly different and takes a while to get used to.

I think you need a foreach in your example

Sorry I was finishing up at work.

If I was writing this in a script and I had an editor with autocomplete (vscode) I'd probably write it the verbose way.

Get-ChildItem "*.txt" | ForEach-Object {
Copy-Item -Path $_ -Destination $_.bak
}

If directly on the shell I'd use the short forms for everything
gci "*.txt" | % { cp $_ $_.bak }

Gah, writing this on my phone and forgot the quotes for the second one.
gci "*.txt" | % { cp "$_" "$_.bak" }

Sorry bout that.

If you think you need a foreach you simply don't understand PowerShell on a fundamental level. PS is a stream processing language and most built-in commandlets are designed around taking piped input and applying some operation on each item in the stream.

Im clearly tired as fuck today, i forgot the double quotes in the first one too.
FUCK.
Get-ChildItem "*.txt" | ForEach-Object {
Copy-Item -Path "$_" -Destination "$_.bak"
}

I shouldve waited til i was on a computer to post but there you go.

>using ls output as an argument for any command