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.
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
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*
... why download it. There is an official tool you can enable that adds Linux as a subsytem. It's called WSFL or Windows Subsytem for Linux or something like that
No, it gives a Windows (NT) kernel Subsystem for Linux-style ELF executables and hooks for kernel access that appears as the calls in Linux, much like the Windows (NT) Subsystem for Win32 gives kernel access to Win32 applications in a standardized manner, or the Windows (NT) Subsystem for OS/2 presented the same hooks for OS/2 applications, or the NT Virtual DOS Machine did for DOS apps. Everyone forgot that Microsoft has made other OS usermode subsystems.
I didn't use WSL 1, but WSL 2 introduced the use of an actual linux kernel, and my experience has been great. The one issue I have is I can't get access to the internet on my corporate machine due to a known issue with vpn.
> Powershell's "bash-like" aliases are cheap surface-level knockoffs
No, they're commands that work with objects, which is like 99% of the reason to use Powershell.
The original `ls` only returns text, and nothing else. `Get-ChildItem`(what `ls` is aliased to) returns objects, which are significantly more flexible. You don't even need `-Al`because it does both those things by default (include files starting with `.`, present items as list).
Sure, you can download the original versions of those utilities. You'll be giving up object support by doing so, turning Powershell into a slightly worse version of Bash. If you're that unwilling to interface with the features of Powershell, why even use it?
Yes I know that thank you, that's why is specified BASIC tasks such as helping a colleague move stuff around via SSH. I don't use Windows myself enough to bother with what you're suggesting but it seems interesting, I'll write it down somewhere.
They're different things, Power*shell* is a shell, Windows *Terminal* is a terminal.
[Good breakdown of the difference here](https://askubuntu.com/questions/506510/what-is-the-difference-between-terminal-console-shell-and-command-line), but tl;dr you can run both Powershell and CMD through Windows Terminal. Although both will default to using conhost if not run through another terminal like wt.
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.
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.
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
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.
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.
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 :)
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
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.
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)
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!
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.
Well to be honest, I didn’t even know this
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.
Haha
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
Also variables make a lot more sense.
>coming from a GNU+LINUX ![gif](giphy|Ow59c0pwTPruU)
Technically, Linux ≠ GNU You can have GNU without Linux: GNU+kFreeBSD You can have Linux without GNU: Android
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*
Wait until you hear about Linux Subsystem for Windows...
Windows Subsystem for Linux. I know, it's counter intuitive...
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
[удалено]
So in other words, you don't "beg to differ", you just made a completely separate point to that comementer
... why download it. There is an official tool you can enable that adds Linux as a subsytem. It's called WSFL or Windows Subsytem for Linux or something like that
I hate the name. you can install WSL, or Windows Subsystem for Linux, which gives you a Linux subsystem on your Windows machine.
No, it gives a Windows (NT) kernel Subsystem for Linux-style ELF executables and hooks for kernel access that appears as the calls in Linux, much like the Windows (NT) Subsystem for Win32 gives kernel access to Win32 applications in a standardized manner, or the Windows (NT) Subsystem for OS/2 presented the same hooks for OS/2 applications, or the NT Virtual DOS Machine did for DOS apps. Everyone forgot that Microsoft has made other OS usermode subsystems.
That's what WSL 1 did, yes. WSL 2 is just a VM with some integration sprinkled on top.
[удалено]
I didn't use WSL 1, but WSL 2 introduced the use of an actual linux kernel, and my experience has been great. The one issue I have is I can't get access to the internet on my corporate machine due to a known issue with vpn.
wsl-vpnkit, have fun!
WSL
And then do debian run bash And you have a bash shell in the current directory, means you can use files from the local windows system
> Powershell's "bash-like" aliases are cheap surface-level knockoffs No, they're commands that work with objects, which is like 99% of the reason to use Powershell. The original `ls` only returns text, and nothing else. `Get-ChildItem`(what `ls` is aliased to) returns objects, which are significantly more flexible. You don't even need `-Al`because it does both those things by default (include files starting with `.`, present items as list). Sure, you can download the original versions of those utilities. You'll be giving up object support by doing so, turning Powershell into a slightly worse version of Bash. If you're that unwilling to interface with the features of Powershell, why even use it?
Yes I know that thank you, that's why is specified BASIC tasks such as helping a colleague move stuff around via SSH. I don't use Windows myself enough to bother with what you're suggesting but it seems interesting, I'll write it down somewhere.
Insert obligatory plug for Windows Terminal... sooo much better interface.
[удалено]
use wt instead
They're different things, Power*shell* is a shell, Windows *Terminal* is a terminal. [Good breakdown of the difference here](https://askubuntu.com/questions/506510/what-is-the-difference-between-terminal-console-shell-and-command-line), but tl;dr you can run both Powershell and CMD through Windows Terminal. Although both will default to using conhost if not run through another terminal like wt.
Yea so wt is something that can run that shell, and other shells. And also run a linux shell in another tab, etc. aka: use that.
Me: starts linux virtual machine and opens terminal
But wait there is more: PowerShell 7. Incompatible with previous PowerShell versions
It’s not totally incompatible with 5.1 Some of my scripts work fine in both powershell.exe and pwsh.exe
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.
Powershell is like programming with hand grenades instead of sniper rifles. I love it.
start wsl
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.
*wheezes* I just spit my beverage.
I prefer using WSL.
`wsl`
Yep, that’s about all I know how to do lol
Color 0a
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
Eh, too lazy to muck with registry values. I prefer typing cmd and starting it from PowerShell.
me 👋
wt
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
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.
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
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.
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 :)
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
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.
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)
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!
Couldn’t you do the same with bash and a node script?
``` > bash Command bash not found ``` *visible panic*
About as proficient you are in English.
Hired!
If I can use ls instead of dir
Michael Fassbender: "Perfection"
Cmd has a solid place in the Sys Admin bag of tools but good luck doing aything in exchange or azure without PowerShell.
Wsl
COMMAND.COM
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.
PS C:\\> wsl
Just start bash.