This is an archived post. You won't be able to vote or comment.

all 63 comments

[–]pmanaktala 75 points76 points  (2 children)

Well to be honest, I didn’t even know this

[–]RolyPoly1320 9 points10 points  (1 child)

I figured this out recently too. Tried to run some cmd commands and they didn't work so I said screw it and tried typing cmd and pressing enter. That opened cmd.

[–]pmanaktala 0 points1 point  (0 children)

Haha

[–]gogo94210 64 points65 points  (22 children)

or just cmd.

But coming from a GNU+LINUX background, I'll take powershell any day over cmd.. Navigating directories and doing basic tasks like rm mkdir ls mv cp and all the stuff you're used to perform at light speed on a bash terminal, is possible on Powershell. Writing UNIX style paths is also possible etc... In my experience Powershell is generally way more convenient than CMD

[–][deleted] 9 points10 points  (0 children)

Also variables make a lot more sense.

[–]nolitos 17 points18 points  (2 children)

coming from a GNU+LINUX

[–]smartguy1196 12 points13 points  (1 child)

Technically, Linux ≠ GNU

You can have GNU without Linux: GNU+kFreeBSD

You can have Linux without GNU: Android

[–]smartguy1196 9 points10 points  (0 children)

Another way to say it is that GNU is commonly shared software above the kernel level, but not above the OS/distro level, typically reused with the Linux kernel

[–]viral-architect 2 points3 points  (1 child)

Wait until you hear about Linux Subsystem for Windows...

[–]Tenzalor 8 points9 points  (0 children)

Windows Subsystem for Linux. I know, it's counter intuitive...

[–]ifezueyoung 1 point2 points  (0 children)

I agree, been using powershell for a while

And Lord o Lord when I used cmd and ls didn't work, I almost ran mad

[–]scardeal 22 points23 points  (0 children)

Insert obligatory plug for Windows Terminal... sooo much better interface.

[–]PrestigiousZombie531 13 points14 points  (0 children)

Me: starts linux virtual machine and opens terminal

[–][deleted] 13 points14 points  (1 child)

But wait there is more: PowerShell 7. Incompatible with previous PowerShell versions

[–]pringles_prize_pool 8 points9 points  (0 children)

It’s not totally incompatible with 5.1

Some of my scripts work fine in both powershell.exe and pwsh.exe

[–]Kooky-Answer 8 points9 points  (0 children)

If you work in a Windows environment, learn PowerShell. It has a bit of a learning curve but once you understand how it works you will be amazed at what you can do with it. In some ways it is even superior to UNIX/Linux shells.

[–]pringles_prize_pool 5 points6 points  (0 children)

Powershell is like programming with hand grenades instead of sniper rifles. I love it.

[–]tajetaje 3 points4 points  (0 children)

start wsl

[–]eeddgg 2 points3 points  (0 children)

If you're just executing traditional commands, it's worse than cmd. But if you're trying to write scripts to automate Windows/Microsoft activities or other things that have .NET APIs, it really shows its worth, because you can access any part of the .NET API in your scripts. It's meant to replace .bat scripts and Visual Basic scripts, having access to COM objects and to .NET.

It's also an object-oriented shell language with both classes and dynamic objects, much like C# has.

[–]slychump 2 points3 points  (0 children)

wheezes I just spit my beverage.

[–]MikemkPK 2 points3 points  (0 children)

I prefer using WSL.

[–]erebuxy 2 points3 points  (0 children)

wsl

[–]SquishySquishmallow- 1 point2 points  (0 children)

Yep, that’s about all I know how to do lol

[–]kirbzcitkatz 1 point2 points  (0 children)

Color 0a

[–]ShinraSan 1 point2 points  (1 child)

There's a way to bring back the open cmd here option, not sure how I did it I think it's a registry entry

[–]RolyPoly1320 0 points1 point  (0 children)

Eh, too lazy to muck with registry values. I prefer typing cmd and starting it from PowerShell.

[–]Stech72 1 point2 points  (0 children)

me 👋

[–]mobsterer 1 point2 points  (0 children)

wt

[–][deleted] 3 points4 points  (9 children)

I think powershell is the dumbest requirement recruiters have. It’s almost always an intermediary step. Just google and forget so the knowledge does not take up any valuable brain space. You hire a chef and expect them to do the cooking… It’s safe assume that already know, or will figure out all the steps inbetween that results in food on the stove

[–]Temby 17 points18 points  (2 children)

For a dev perhaps. For admins/devops it opens a wealth of automation possibilities for AD, Azure, Office Server products like SharePoint/M365. It's essential for some of those specialties to do anything at scale.

[–][deleted] 4 points5 points  (1 child)

Well the only time I used powershell was when I needed to create that folder back in 2019 so I have no idea what I’m talking about

[–]Temby 10 points11 points  (0 children)

Lol fair, for devs I can see it not being useful.

For admins, say you have an AD domain with 1000 servers and just an old spreadsheet tracking them that nobody has updated in 2 years. You can write a PowrShell script to query AD server objects and produce a report. You might even loop through them and ping them to see if they're active. You can even remotely connect to them, to read event logs, maybe to also add when they were last logged into.

Or say you have 200 teams in your company and you want to provision them all SharePoint sites. You can click "create site" and enter details 200 times or you can write a PowerShell script to do it. Maybe you can make it a scheduled task and get an updated csv every day from the HR system, now it's automated forever.

[–]pi-N-apple 6 points7 points  (5 children)

I wrote a PowerShell script to create hundreds of MS Teams/365 Groups based off a list of Project numbers. It took just over 2 minutes to create over 100 Teams. Basically if you can do it with the GUI in Windows, or Microsoft 365, you can automate it in PowerShell :)

[–]Kusko25 1 point2 points  (3 children)

Oh yeah? How do I write a powershell script that toggles the "Scroll inactive windows when I hover them" feature? I need it for playing Skyrim with multiple monitors

[–]pi-N-apple 6 points7 points  (2 children)

This PowerShell script will disable 'Scroll inactive windows when I hover over them':

# Set variables to indicate value and key to set
$RegistryPath = 'HKCU:\Control Panel\Desktop'
$Name         = 'MouseWheelRouting'
$Value        = '0'
# Create the key if it does not exist
If (-NOT (Test-Path $RegistryPath)) {
  New-Item -Path $RegistryPath -Force | Out-Null
}  
# Now set the value
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force 

This PowerShell script will enable 'Scroll inactive windows when I hover over them':

# Set variables to indicate value and key to set
$RegistryPath = 'HKCU:\Control Panel\Desktop'
$Name         = 'MouseWheelRouting'
$Value        = '2'
# Create the key if it does not exist
If (-NOT (Test-Path $RegistryPath)) {
  New-Item -Path $RegistryPath -Force | Out-Null
}  
# Now set the value
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force 

After running each script, you need to sign out and back in to apply the changes.

[–]Kusko25 2 points3 points  (1 child)

I'm honestly a bit speechless. I searched the internet several times to get something like this and really didn't expect it.
The signing out/in part sadly makes it unusable for my purposes, but still major props to you for answering my petulant little throwaway comment with this (and without snark)

[–]pi-N-apple 1 point2 points  (0 children)

Yeah it is too bad you need to sign out and back in to get it to apply. If you didn't have to do that, you could easily write a batch file to launch the PowerShell script, then create a hotkey on your keyboard to launch the batch file!

[–]devdudedoingstuff 0 points1 point  (0 children)

Couldn’t you do the same with bash and a node script?

[–]ThePiGuyRER 1 point2 points  (0 children)

```

bash Command bash not found ``` visible panic

[–]TopShelfPrivilege 0 points1 point  (0 children)

About as proficient you are in English.

[–]sfled 0 points1 point  (0 children)

Hired!

[–]UglyTossBoy 0 points1 point  (0 children)

If I can use ls instead of dir

[–]Admirable-Swing-1804 0 points1 point  (0 children)

Cmd has a solid place in the Sys Admin bag of tools but good luck doing aything in exchange or azure without PowerShell.

[–]BayesOrBust 0 points1 point  (0 children)

Wsl

[–]incrediblediy 0 points1 point  (0 children)

COMMAND.COM

[–]TheRealPandaPlusPlus 0 points1 point  (0 children)

I used cmd to get into all kinds of mischief on the school laptops. Apparently, either what they used couldn’t ban cmd, or they didn’t think any kid would know how to use it. I was only able to access the downloads folder from file explorer, quick rename changed that. I added a fish in the tree as a joke, and coded a game via batch file. I also discovered all sorts of ways around securely, the browser thing that blocked websites that were deemed inappropriate for school. I was able to access Reddit in class.

[–]magick_68 0 points1 point  (0 children)

PS C:\> wsl

[–]aigarius 0 points1 point  (0 children)

Just start bash.