Live data from Hacker News

Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

news.softpedia.com

261–270 of 350 posts

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#261
post #53

By the way, where does the capitalized kebab case come from? Prior art or just Microsofts general hankering for capitalization (e.g. C#s Class.DoSomething() vs Java's Class.doSomething())?

Wikipedia calls it Train-Case but doesn't provide a source. https://en.wikipedia.org/wiki/Letter_case#Special_case_style...

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#262
post #3

"Typing cmd in the run dialog will launch PowerShell as well" What? I'm a big PowerShell fan, but I see the need to keep cmd around for a while. Clobbering it before it's phased out seems problematic.

You can run any command from CMD in Powershell

Does Powershell support all my old batch scripts?

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#263
post #257

Earlier quoted context omitted.

'troll' * 1000 > out.txt Open in NotePad++, no weird newlines in the wrong place, content not truncated. Were you using |format-table and |format-list (ft, fl) to explicitly format the text for console viewing, then redirecting that to a file?

Took a while to reproduce the actual case, and it's Select-String that's at fault. And it must be in "powershell" not "powershell ISE". 'troll' * 1000 > troll.txt .. works fine as you say Select-String -Path .\troll.txt -Pattern "t" > t.txt .. wraps the output at the console width. Which means you can't use it as a grep replacement.

You can't use it as grep in bash, because it isn't that. It outputs [MatchInfo] objects, not text, and Out-File (>) formats complex objects for console viewing (for ??? reasons), which is one reason > isn't a great PS habit.

    Select-String -Path .\troll.txt -Pattern "t" | Set-Content t.txt

    or

    sls 't' .\troll.txt | sc t.txt

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#264

Windows fan here. I hate PowerShell and I'd much rather have Bash built into Windows. Things I hate about PowerShell: - You can't even run your own scripts without performing the Set-ExecutionPolicy ceremony first or signing your scripts. - It's way too verbose. - It's a strange bird that next to nobody uses, so there's zero motivation to learn it. - It's not "old reliable". You can't depend on it working due to the…

I'm going to address each bullet:

- Set-ExecutionPolicy can be set with a single click from the "For Developer Settings." Just scroll down and hit Apply three times and your machine has sane developer defaults (inc. ExecutionPolicy).

- The verbosity means that you can "guess" PS commands. Each PS command is a set layout with an action word (e.g. Add, Clear, Get, Write, etc) and then target (e.g. Set-Alias, Set-Date, Set-Service, etc).

- A ton of people use PS. In particular SysAdmins are moving from VBS/Bat to PS in droves. No clue what communities you hang out with where nobody uses it?

- It is definitely still a work in progress. But most of the core parts of the language hasn't changed much, if you wrote a PS file three years ago it likely still works today. All they've done is add new cmdlets, new libraries, and new functionality which doesn't hurt backwards compatibility.

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#265

Earlier quoted context omitted.

You can run any command from CMD in Powershell

But are all cmd commands portable verbatim to powershell? With all the options / special characters? (I don't know the answer, but https://en.wikipedia.org/wiki/PowerShell#Comparison_of_cmdle... lists quite a few missing commands, including "talkkill" and "find") With the amount of online posts that tell you "to achieve X, open command prompt and run ...", it would be a bad idea to break any of them that go beyond a…

There can be several aliases for a single command.

ls=dir=gci="Get-ChildItem"

But you can't run just run "dir /s". You'd have to say "Get-ChildItem -Recurse" which can be shortened to "dir -Recurse" which can be shortened to "dir -r".

When scripting, you try to use the longform versions. With one-liners, you just sort of fall into whatever paradigm you were previously accustomed to for your first argument.

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#267
post #216

Earlier quoted context omitted.

Literally every windows admin uses it. It's the official commandline interface for microsoft software. Every piece of microsoft software must provide a ps interface. It's an engineering directive.

That's all correct and it is the right way to do things (especially from Microsoft's perspective). However, the main goal of Powershell seems to be providing a scripting language that can automate Windows internals and not a shell in which you live in. Powershell is just a nice REPL, not so much a shell as you might be used from Bash. We have had Powershell for 10 years now. Has it taken off in a big way? No. The adm…

I wouldn't take out bash or zsh or whatever else to do a project either. But I do use it when I want to run a bunch of cmdline tools.

Right tool for the job and all...

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#268

Earlier quoted context omitted.

It is strange to claim no one really uses powershell. It is widely used in the Windows world. The main complaint I see about powershell is that it isn't bash. The object pipeline in powershell can be so much more powerful than parsing text between commands. After all, that's why we have data types instead of storing everything in strings.

It's not widely used in the Windows world from what I can see. Walk into any office and ask an IT guy to run "ipconfig". They'll open up cmd.exe without even thinking about it. I read a lot of programming tutorials. Nobody ever reference PowerShell in them. They always instruct people to open cmd. Do you have any evidence to the contrary?

> Walk into any office and ask an IT guy to run "ipconfig". They'll open up cmd.exe without even thinking about it.

Absolutely because of twenty years of muscle memory.

But once Powershell is the default and they learn about the wonderful "gip" alias, they'll be hooked. "gip" in case people don't know is an alias for Get-NetIpConfiguration which is a more powerful version of IPConfig.

PS - "gip -all" is useful. "gip -all -d" for more detailed results.

Re: Microsoft Replaces Command Prompt with PowerShell in Latest Windows 10 Build

#269

Windows fan here. I hate PowerShell and I'd much rather have Bash built into Windows. Things I hate about PowerShell: - You can't even run your own scripts without performing the Set-ExecutionPolicy ceremony first or signing your scripts. - It's way too verbose. - It's a strange bird that next to nobody uses, so there's zero motivation to learn it. - It's not "old reliable". You can't depend on it working due to the…

Powershell users don't age gracefully, that's for sure. You'll learn some arcane long-winded way of doing something in v3 and it will be relaced with something far better. Unfortunately, you'll still have to know the old way.

As for longwinded, I hate using ACL in Powershell. Let's say you have to reestablish FullControl on a bunch of files as an Administrator and you don't have Write access. It's so convoluted and it can even fail silently. So much easier to just use icacls in a single line.

Post reply on HN