Live data from Hacker News

How bad is the Windows command line really?

blog.nullspace.io

31–40 of 110 posts

Re: How bad is the Windows command line really?

#31

I get perverse joy out of using the Windows CMD.EXE shell (and the earlier COMMAND.COM from MS-DOS). Yes, it's tremendously crufty, idiosyncratic, and sometimes seems down-right illogical in its behavior. Arguably, just about anything else is better, but it holds a special place in my heart.

If I could downvote you, I would. That's probably why I'm not allowed to. :)

Re: How bad is the Windows command line really?

#32

Earlier quoted context omitted.

You can also normalize them using the dos2unix package, which is available on most distros.

Have the line ending wars ended yet? Apple is finally Unix \n, but most internet protocols are \r\n as are Windows. Though honestly, Windows just doesn't even matter any more to me, I haven't needed to touch an MS product in years...

Git for Windows asks during installation if you want to replace your Windows line endings with Unix-style. You can have it replace LF with CRLF on checkout and revert on commit, or you can just have it do the revert (swap CRLF with LF) on commit and not do the first replace. Or you can just leave everything as-is.

Interestingly, when manually making a multi-line string in Powershell, only the LF character ( `n ) is needed to make a new line. Using CRLF ( 'r'n ) gives identical behavior in most strings.

Re: How bad is the Windows command line really?

#33
post #13

Powershell is garbage. .Net does utf8 by default but powershell, built on .Net, manages not to. Try type utf8Encoded.txt > out.txt in cmd.exe and posh. Cmd works and posh fs it up. And after you do figure out utf8 encoding in posh, it'll always add a BOM just to screw you

That's a real bug, but I'm not sure that it means powershell is garbage.

Re: How bad is the Windows command line really?

#34
post #15

Agree about Windows command prompt being lame compared to bash, but I really find PowerShell amazing, even more so then bash. If you look at all the recent (even not so recent) products from MS, it is clear that PowerShell is the shell for Windows, and not batch. I didn't get the cure for polio analogy that's in the article but I really think anyone that's comparing shells should compare with PowerShell.

You're on Hacker News. Most people who say they hate powershell have done so little posh they don't even know 'select' or 'where'.

Re: How bad is the Windows command line really?

#35
post #13

Powershell is garbage. .Net does utf8 by default but powershell, built on .Net, manages not to. Try type utf8Encoded.txt > out.txt in cmd.exe and posh. Cmd works and posh fs it up. And after you do figure out utf8 encoding in posh, it'll always add a BOM just to screw you

I guess if problems with unicode are the bar for "garbage" then Ruby must be a garbage language?

Re: How bad is the Windows command line really?

#36

Earlier quoted context omitted.

You can also normalize them using the dos2unix package, which is available on most distros.

Have the line ending wars ended yet? Apple is finally Unix \n, but most internet protocols are \r\n as are Windows. Though honestly, Windows just doesn't even matter any more to me, I haven't needed to touch an MS product in years...

https://en.wikipedia.org/wiki/Newline#History

\r\n, CR+LF historically speaking was the first, but \n, LF became dominant because of Unix.

Re: How bad is the Windows command line really?

#38
post #13

Powershell is garbage. .Net does utf8 by default but powershell, built on .Net, manages not to. Try type utf8Encoded.txt > out.txt in cmd.exe and posh. Cmd works and posh fs it up. And after you do figure out utf8 encoding in posh, it'll always add a BOM just to screw you

No doubt the result of adding another layer of complexity: "type" in cmd is basically Unix cat, it just reads the file and writes it to standard output byte-for-byte. PS probably does some hidden encoding-autodetection and attempts to perform translation, but doesn't always get it right.

You can see the difference in philosophy here, cmd (and bash, to a certain extent) are simple and don't try to do sneaky things silently, even if it means you might have to do a little more yourself e.g. performing character set translations explicitly. The behaviour is straightforward and predictable. PS attempts to be more "user-friendly" by doing some hidden conversions presumably so the user doesn't have to explicitly do character set translations, and when it works it works well; but when it fails, it fails spectacularly.

Re: How bad is the Windows command line really?

#39

This isn't completely related to Windows command line but I thought I would post it out here. I was trying to run a Bash script from a Git repo mounted in a Docker container. When running the Bash script, I kept getting all kinds of errors. I ran the exact same script in the same Docker container on a different Linux computer that had cloned the repo. It turns out the \r Windows line endings (which I later normalized…

You can also normalize them using the dos2unix package, which is available on most distros.

Or just `sed -e 's|\r||'`.

Re: How bad is the Windows command line really?

#40
post #21
post #5

In computing, "batch" connotes long running processes in addition to "script"'s connotation of collapsing multiple commands into a single one. The seemingly redundant parsing by the Batch interpreter is a feature, not a bug. 1. The parser allows modifying a .bat file during its execution and having those changes execute without restarting the Batch interperter. [1] This is in keeping with the rationale for batch proc…

But bash was around in the 80's, too, right? And it didn't seem to need those features. How did bash users get around your claimed need for this?

I apologize for writing in a manner that would mislead someone into believing that I claimed that self modifying code was a need for anyone, let alone systems programmers. It's all Turning complete, even if that completeness comes complete with a tarpit.

To a first approximation, I'd expect that 1980's Unix programmers would generally be working in environments more accepting of restarting a batch process when there was an error in the code, i.e. significantly less likely to hold a clerical or secretarial "TCP report" job in a regular commercial office. Though that split has become less likely, it's still pretty uncommon for a computer user with little control of their work environment and deadlines to be using *nix rather than Windows.

Post reply on HN