Live data from Hacker News

A Saner Windows Command Line

futurice.com

91–100 of 164 posts

Re: A Saner Windows Command Line

#91
post #11

Earlier quoted context omitted.

I made a big push at some point to start using Powershell instead of the horrible .bat files I had written at some point (and their arcane unreadable commands). But Powershell's syntax, convoluted names and the unreadable code we had to write to do simple things really made me reconsider seriously. I simply use Python for these things (99% time it has all I need).

I don't really understand this. If you don't like the verbose names of PowerShell commands, you still have the option to set up command aliases. Out of the box, PowerShell includes a number of common Unix terminal commands as aliases: https://technet.microsoft.com/en-us/library/dd347739.aspx

Ha, that explains why the other day I typed 'ls' out of habit in Powershell and it still printed out the folder contents. Now that I know it's not just that one command, it should make some things easier.

Re: A Saner Windows Command Line

#92

>> Let's be honest. What many people think of as "the default Windows command line", cmd.exe, is atrociously bad. Selection is awkward, resizing is hard, the syntax is arcane, the list goes on. If you do nothing else, there are two things you can do to make the basic, vanilla experience bearable. Funny, from a guy coming from Windows to Unix I think the exact opposite. Each command comes with a bazillion options and…

> A= 123

> cd..

So your rant is about the syntax, of a language established for decades. You have options though: modify bash, or raise awareness enough that a simple `alias cd..='cd ..'` is included in the default release.

Re: A Saner Windows Command Line

#93

>> Let's be honest. What many people think of as "the default Windows command line", cmd.exe, is atrociously bad. Selection is awkward, resizing is hard, the syntax is arcane, the list goes on. If you do nothing else, there are two things you can do to make the basic, vanilla experience bearable. Funny, from a guy coming from Windows to Unix I think the exact opposite. Each command comes with a bazillion options and…

> Having been on unix for the last 7mo after years of windows, I do like some things but let's not be too quick to call the kettle black

Who's calling the kettle black? You seem to be painting this as a Windows vs. Unix thing, but the original article never mentioned Unix.

Re: A Saner Windows Command Line

#94
post #2

At our office we jokingly refer to powershell as "two googles per line" - a term coined by its strongest proponent at the company. It thought it would come naturally over time, but it never does. It seems needlessly cryptic and verbose in so many ways. I've started using LinqPad for stuff I would normally do in cmd now.

I don't really understand this- I always found the "get-help" commandlet to be sufficiently informative, unless they were using parts of the .NET framework that I wasn't already familiar with, in which case I needed to go read about those objects/etc. on my own. Is this that bad?

Well, the man page of nearly any command is also good enough to avoid a google search (yes, git is an exception).

That isn't much comforting. And frankly, MS always pushed Power Shell as a better way to do things than the ancient options for command line, thus color me disappointed that it couldn't be better than the "default choice" Bash.

Re: A Saner Windows Command Line

#95
post #77

Earlier quoted context omitted.

I prefer Python when appropriate, but if you're going to "shell out" a lot and pipe a bunch of commands together it starts getting too verbose and loses it's elegance. I agree with other posters that bash is not intuitive, but if you've worked with it for a long time, there's nothing like being able to cat | grep | sed in a one-liner, rather than creating a bunch of Process objects, etc.

If you're doing cat, grep, sed I'd say that bash is very intuitive and I use it for that purpose all the time. If you're writing bash scripts, with if structures and loops and everything, then just python.

Perhaps an unpopular opinion, but I still prefer to stay in bash even when I need loops and conditionals. If I'm already writing in Python, then sure, Python it is. Or ruby, or js, or whatever I'm in. But when I'm in bash and I can do it easily enough in bash, why complicate?

Re: A Saner Windows Command Line

#96
>Upgrade to Windows 10... the benefits really can't be overstated.

except that there's tons of drawbacks to counteract said benefits. Privacy notwithstanding, power-use has been fractured and the flow of configuration ruined in 10

Re: A Saner Windows Command Line

#97
post #86
post #72

Earlier quoted context omitted.

PowerShell objects are actually a superset of . Net objects. They can also represent COM objects, WMI objects, XML nodes, etc. You can also export them to CSV, XML, JSON, and yes, even text. If you have cygwin installed you can pipe to and from the cygwin commands from PowerShell and pipe to and from powershell.exe from your cygwin shell.

Languages are not the same, you'll never have interoperability; try exporting a .NET object with a 64-bit integer to be consumed by JavaScript, for example. Text wins.

You would serialise it?

$obj = [PSCustomObject]@{ Number = [long]2 }

$obj | ConvertTo-Json

Re: A Saner Windows Command Line

#98
post #86
post #72

Earlier quoted context omitted.

PowerShell objects are actually a superset of . Net objects. They can also represent COM objects, WMI objects, XML nodes, etc. You can also export them to CSV, XML, JSON, and yes, even text. If you have cygwin installed you can pipe to and from the cygwin commands from PowerShell and pipe to and from powershell.exe from your cygwin shell.

Languages are not the same, you'll never have interoperability; try exporting a .NET object with a 64-bit integer to be consumed by JavaScript, for example. Text wins.

You can have interoperability, COM does it well on Windows. JavaScript, .net, Python, ruby, C, C++ can all access COM methods and attributes.

Re: A Saner Windows Command Line

#99

To hear bash-people to call Powershell "non-intuitive" sounds like those immigrants that go to a foreign land, refuse to learn the local language and insist on the natives to understand their immigrant language. Or like programmers that think that every programming language should have the C syntax. Bash and Unix commands are only "intuitive" after years of practice; Powershell is not different. And it doesn't have a…

Windows fanboy here. Powershell made the mistake of combining a bad command prompt with a bad scripting language. It is not a "shell" at all. It is bad Python.

The excessive verbosity and object safety is great for admin scenarios where you don't suddenly destroy your corporate email transition because of a VP with an apostrophe in her name. But at that point perhaps you should just use C# instead?

But for everything else it just looks nuts to outsiders. That's why even the MS developer groups are releasing command line tools cross-platform that behave like Unix apps, not PS monstrosities.

https://azure.microsoft.com/en-us/documentation/articles/xpl...

Powershell should be a feature that draws people from AWS. Instead it is seen as a drawback, even inside MS.

Re: A Saner Windows Command Line

#100
post #99

To hear bash-people to call Powershell "non-intuitive" sounds like those immigrants that go to a foreign land, refuse to learn the local language and insist on the natives to understand their immigrant language. Or like programmers that think that every programming language should have the C syntax. Bash and Unix commands are only "intuitive" after years of practice; Powershell is not different. And it doesn't have a…

Windows fanboy here. Powershell made the mistake of combining a bad command prompt with a bad scripting language. It is not a "shell" at all. It is bad Python. The excessive verbosity and object safety is great for admin scenarios where you don't suddenly destroy your corporate email transition because of a VP with an apostrophe in her name. But at that point perhaps you should just use C# instead? But for everything…

Simply stating something is bad, without anything to back it up, doesn't make it bad.

Learn some alias's if you don't like the Get-X style of functions.

gal * | more

Will list tons of alias's for you.

Post reply on HN