10 ms·
How bad is the Windows command line really?
- sklogic 10y agoUnreadable on mobile
- brudgers 10y agoNoticeably faster than average on desktop. There's no silver bullet.
- tokenizerrr 10y agoBad contrast, though.
- chickenfries 10y agoSetting a max-width on the body text would make this incredibly more readable on narrower viewports. At 636kb and 48 requests, this page probably isn't as "minimal" as you think it is. For example, should there be any reason you can read the disqus comments at a reasonable size but not the body of the post?
- deleted 10y ago[deleted]
- brudgers 10y agoI tried it on mobile. It still loaded fast. As with many pages, Firefox Reader Mode improved the experience. Though for me, the bulk of the improvement comes from text formatting, part of the improvement is hiding blog comments, ads, email signups, etc. Anyway, my experience is that touching Firefox's reader-mode icon in the address bar is usually faster than a boatload of formatting logic; produces more readability than a website's general optimization, and bypasses all the ancillary crap that people concerned enough to optimize for mobile tend to add.
- sklogic 10y agoFast-schmast, I do not care, cannot read anything at all (chrome on android).
- sklogic 10y agoWtf? Cannot read anything on a right edge. Performance is irrelevant.
- sklogic 10y agoGreat, dowvoted for reporting a problem. Typical HN.
- mwfunk 10y agoRight, because HN is the customer service department for the site hosting the article that somebody submitted a link to. And because "unreadable on mobile" is such an informative statement that contains so much useful data about why it was hard to read and what it was hard to read on. Surely you weren't downvoted for those reasons. Nah, it's just HN being HN.
- sklogic 10y agoIt is informative enough for an author (if he's around) to take an action. Anyone else should just pass by, nothing to see here.
- Retra 10y agoThey did pass it by, and it was down-voted for its irrelevance to the vast majority of users. Then you went and complained about down-votes (with a dismissive insult, no less), like that was an acceptable response. If you make a post that most people don't need to see, then don't worry about the down-votes. When you're getting down-voted for writing something most people do need to see, then there's a problem.
- brudgers 10y agoPerhaps someone felt that the page layout was far enough off topic as to be a distraction or otherwise reduce the quality of the discussion. Personally, I've found treating unexpected downvotes as editorial feedback on the quality of my writing helpful. I just assume that: 1. I didn't make my point clearly 2. My comment was low quality 3. Someone just disagrees with the point In the first case, I edit or delete it. In the second case I just delete it...except in those cases when I deliberately make a low quality comment knowing it is likely to attract downvotes. The third case reduces to the other two in practice, though not so much in logical theory.
- rblatz 10y agoI had no issues reading this with an iPhone 6 using safari.
- sklogic 10y agoChrome on Android - not scrollable close to the right edge.
- nonamegdsa 10y agoBroken on Chrome on Samsung Galaxy S5.
- YeGoblynQueenne 10y agotl;dr: batch will steal your soul and sell your kids to the Great Old Ones' cultists. Bash is meh (the author doesn't really know much about bash). User Powershell. Save the world. ... and it's all true.
- tr1ck5t3r 10y agoIts good enough to bypass UAC & AV and run whatever you like. You dont even need to give your software a ".exe" extension to run code. Just rename a program removing its .exe extension, then call it from the command line. It will run! Its perhaps better to compare dos BATch files with bash.
- byuu 10y agoIt's really, really, really, really really bad. It doesn't even have a logical history. Despite having used it for many years, I still don't understand why when I type one command (eg make), and then another (eg out.exe), I have to toggle between pressing up or pressing down from the new command-prompt to access the previous commands. I can't make the window more than 80-characters wide dynamically. (I don't want to change settings and restart the program to get the width to change.) So any time I want to copy and paste one of the infamous wall-of-text C++ template errors, I have to waste a lot of time reformatting the text. Copy-and-paste as well is just complete garbage that takes forever. I have to dump batch files into a folder in PATH because there's no alias support nor .profile startup script. I can't color-code the prompt separately for visibility. There's no tab-completion. There's no shell escaping backticks. On and on. Batch scripts are just hopelessly broken. It really feels like we're abusing the hell out of them to do things they were never intended to do. The language is closer to Malbolge than C. PowerShell is a whole other can of worms. I don't care for it either, but that'd be a separate discussion. Bash on Windows sounded promising, up until "Windows 10 only" and "doesn't play nice with the regular Windows environment."
- sixothree 10y agoI agree it's pretty bad. But... > I can't make the window more than 80-characters wide dynamically. Windows 10 fixes this. You can resize the window and it wraps text better than any other terminal out there. > Copy-and-paste as well is just complete garbage that takes forever. Turn on Quick Edit. Now drag to select and right click to copy. > There's no tab-completion. Tab completion for filepaths works quite well for me.
- sandworm101 10y ago> Turn on Quick Edit. Now drag to select and right click to copy. Command line + mouse = GUI, not command line.
- NetStrikeForce 10y agoI'm curious, how do you copy and paste in Bash without a GUI?
- theseRtheworst 10y agoThese articles are the worst. They are useless. You don't like cmd.exe? Oh no! Both Windows and UNIX are big piles of C code. They are more alike then they are different.
- deleted 10y ago[deleted]
- brudgers 10y agoIn 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 processing -- facilitating serial execution of computationally expensive operations. 2. The Batch interpreter allows self modifying code.[2] In the early 1980's when Batch was designed, sophisticated COBOL programmers might have felt right at home. Lisper's were probably more hit and miss. This is a case where historical context is useful. Today, it might perhaps be worth mentioning Powershell in a discussion of the Windows command line. Batch was the DOS command line and exists in Windows for evolutionary reasons. In the days when abundant RAM and fast CPU speeds were prefixed with "mega" and distributed computing often happened at BAUD rates, not restarting a process was a big deal. More importantly, then as today, the execution speed of the batch interpreter was not a critical section of a batch process. [1]: https://stackoverflow.com/questions/906586/changing-a-batch-file-when-its-running https://stackoverflow.com/questions/906586/changing-a-batch-... [2]: http://swag.outpostbbs.net/DOS/0019.PAS.html http://swag.outpostbbs.net/DOS/0019.PAS.html
- Roboprog 10y agoI remember when I learned that command.com kept the current .bat file open when running it, rather than reading it into memory (like most other interpreters that I used or learned at school). We had a client on a Novell network with a menu program that generated .bat files to start the program selected, then restart the menu program. This turned out not to work very well on a multi-user network, as user A would exit an app, and continue running the .bat at some offset, which user B would now have caused to have different content, and probably not even a line break at said offset into "THE" file. Easy enough to fix by having the menu program put the run script (.bat file) into the Novell equivalent of each user's home directory, but it was a real WTF moment at first :-)
- j2kun 10y agoBut 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?
- EvanAnderson 10y agoI 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.
- Esau 10y agoI was recently reading about OS/8, which happened because I have become interested in SIMH, and I was surprised to see how similar some of its commands are to those from DOS (which in turn copied CP/M). It was interesting to see the ASSIGN command on another OS. https://en.wikipedia.org/wiki/OS/8 https://en.wikipedia.org/wiki/OS/8
- conceit 10y agoIf I could downvote you, I would. That's probably why I'm not allowed to. :)
- choosername 10y agokill-it-with-fire kind of downvote, not a HN smug just-because-I-can kinda downvote.
- tacos 10y agoThere are, of course, choices beyond Bash, Batch and PowerShell. I'm a Microsoft fanboy and I find Python far more structured and faster than any of the above for anything beyond the most simple shell scripts. (If only the inventor of PowerShell had spent ten minutes outside the Microsoft ecosystem before locking himself in a seafoam green office for two years...) Doesn't solve the IT admin scenarios PowerShell is good for but I don't go there. And if I did, I'd use C# anyway. No need to learn a new language to loop and call objects, that's solved. With the .NET Core stuff, I'm using C# and Microsoft.DotNet.Cli.Utils and the end result is briefer and saner than Python argparse, and file operations work great cross platform. Less issues than even Python, plus I can use LINQ to sort and remove dupes. Handy. As for the "Windows command line" (cmd.exe) well, it still sucks. Console2 plus Clink and ... well, you'll still miss zsh on cygwin or what just works out of box on Mac... but, hey, it's a start.
- mlvljr 10y agoPython seems to have its quirks, too (somewhat inconsistent ways of wrapping OS errors into exceptions, for example), but for structuring complex pieces of logic into files, funcs and classes, it's almost perfect.
- elchief 10y agoPowershell 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
- stephengillie 10y agoThis has frustrated me to no end. I've given into using WriteAllLines as a work-around. [IO.File]::WriteAllLines($filename, $content) (from https://stackoverflow.com/questions/5596982/using-powershell-to-write-a-file-in-utf-8-without-the-bom https://stackoverflow.com/questions/5596982/using-powershell...)
- lqdc13 10y agoI get OOM with larger files even when they should fit in memory. Powershell is like a poor Java/C# interpreter instead of a quick and dirty shell.
- nailer 10y agoThat's a real bug, but I'm not sure that it means powershell is garbage.
- InclinedPlane 10y agoI guess if problems with unicode are the bar for "garbage" then Ruby must be a garbage language?
- userbinator 10y agoNo 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.
- itaysk 10y agoAgree 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.
- userbinator 10y agoThe worse thing about PowersHell is its syntax and OOP-ifying of everything, even if it doesn't really need to be. The naming and general syntax reminds me of this: http://steve-yegge.blogspot.ca/2006/03/execution-in-kingdom-of-nouns.html http://steve-yegge.blogspot.ca/2006/03/execution-in-kingdom-... I don't deny that it is much more powerful than cmd, but it feels a lot like "emacs rather than vi" in its design, and I much prefer the latter (which would be more (ba)sh-like.)
- nailer 10y agoYou're on Hacker News. Most people who say they hate powershell have done so little posh they don't even know 'select' or 'where'.
- stephengillie 10y agoSelect-Object or Select-String?
- nailer 10y ago'select-object' - 'select' is it's default alias.
- vetinari 10y agoNobody starts using posh just because some new cool thing in the shiny new OS. My first impression of it? It went like this: Task: you need to connect to Hyper-V VM console via Remote Desktop. Hiccup: for that, you need to know it's GUID. How to find it out? Just run this handy posh script... (https://blogs.msdn.microsoft.com/virtual_pc_guy/2014/11/25/using-rdcman-v2-7-to-connect-to-a-vm/ https://blogs.msdn.microsoft.com/virtual_pc_guy/2014/11/25/u...) Another hiccup: That script does not work, it needs some library that's not loaded by default. Try to find out how. Another hiccup: It does not load, because it breaks some policy, that's off by default. Investigate, what to do. How it ended: forget it, I have better things to do than solve problems with Powershell. Look into VM files and find out, that it's one of the GUIDs there. Result: Won't touch posh again and anyone singing about its virtues is getting promptly ignored. Maybe it's not fair to Powershell, but the first impression counts.
- jasonjei 10y agoThis 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 in Git settings) caused my script to barf.
- chipperyman573 10y agoYou can also normalize them using the dos2unix package, which is available on most distros.
- bluejekyll 10y agoHave 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...
- stephengillie 10y agoGit 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.
- userbinator 10y agohttps://en.wikipedia.org/wiki/Newline#History https://en.wikipedia.org/wiki/Newline#History \r\n, CR+LF historically speaking was the first, but \n, LF became dominant because of Unix.
- dingo_bat 10y agoThe cmd.exe on Windows 10 is a significant improvement from older versions. So much so that it has become actually useful now.
- daigoba66 10y agoI think you're thinking of conhost which is the console window program used to run cmd.exe, PowerShell, et al. That has some new features. But I don't cmd.exe itself saw many, if any changes in Win10.
- dingo_bat 10y agoOne of the biggest (maybe silly) change is that cmd is fully resizable. I think Powershell was already able to do this in Win 7. So I think apart from the changes to conhost, cmd itself has been upgraded in some ways.
- mschuster91 10y agoI usually write shellscripts in PHP. Works pretty good, and PHP is by far easier to write than either bash scripts or Windows shell script - not to mention that one single syntax can be used for both OSes, which is nice when you do development on both Linux and Windows, and even nicer when you're also developing on OS X which ships a horribly outdated bash (and other coretools).
- nacs 10y agoI am by no means a PHP hater (I do some PHP dev for work) but PHP not only has multiple versions (4, 5, 5.3) but has a ton of modules for everything (curl, mbconv, openssl, etc) that have to be setup the same way for you to get the same behavior across OSes. Not sure it makes a great shell script for that reason.
- mschuster91 10y agoOn systems I control, I currently stick with the latest PHP5 release, unmodified - either the distro maintainer version, or in case of Windows, the official binaries. Configuration customization isn't really needed, only the usual date.timezone to get rid of the warning (and hell, this is annoying! can't PHP just use the OS-provided time zone?!), and in extremely rare cases the memory limit and max_execution_time.
- kmiroslav 10y agoPersonally, one of the reasons why I fell in love with Ruby 10+ years ago was because I realized I could use it instead of CMD or bash to write all my scripts from now on. Regardless of the platform. Obviously, this applies to Python as well if that's more your thing. I've never gotten into PowerShell but I have absolute respect for the concept behind it, and how much more advanced it is than any shell you can find on UNIX. Think about it: instead of piping several commands through an unspecified string protocol that varies between each command (essentially what UNIX does), you are now piping real language objects in a uniform binary protocol defined by the shell itself.
- bad_user 10y ago> you are now piping real language objects Which is in fact a bad idea, because in order for stdin to accept objects and stdout to output objects, now those commands have to be powered by PowerShell and .NET. In other words you're in a very finite and closed environment that does not interoperate with the outside world. You know, love or hate Unix, but the fact remains that this family of operating systems, including its command line, has survived the test of time. And it has done so because it has at its core a set of philosophical principles. And one of those is that programs that handle text streams are preferred, being highly interoperable, as text is a universal interface [1]. And you know it's funny how people loathe Unix, but at the same time rediscover its principles (and often implement them badly) again and again. [1] http://www.faqs.org/docs/artu/ch01s06.html http://www.faqs.org/docs/artu/ch01s06.html
- adzm 10y agoThose who don't understand Unix are doomed to repeat it.
- tbyehl 10y agoThose who haven't read the Monad (Powershell) Manifesto[1] are doomed to keep repeating Unix's failures. [1] http://www.jsnover.com/blog/2011/10/01/monad-manifesto/ http://www.jsnover.com/blog/2011/10/01/monad-manifesto/
- alkonaut 10y agoIt's absolutely laughable. But I've almost come to see this as a feature - It's so terrible that no one relies on it or uses it. Bash in my opinion is overused.
- ams6110 10y agoI honestly feel like I am missing something. What is the current excitement about bash on Windows? It's been available (and something I commonly use) via cygwin for years. And cygwin's bash can run .exe binaries.
- tacos 10y agoCygwin is quite slow due to problems emulating fork (large builds take forever!), plus the package support is spotty. I'm excited because I can eventually ditch Cygwin and VMs for much of my Linux compatibility testing and cross-platform work. And I'm glad Microsoft is finally putting some effort into this long-neglected area. For the moment, I'm still stuck with Cygwin, shaking my head a bit too.
- NetStrikeForce 10y agoCygwin apps have to be compiled for Cygwin, as opposed to this Bash on Windows thing that runs Linux binaries out of the box :-)
- adzm 10y agoI've just spent way too much time trying to get utf8 to work well on the command line, ugh.
- agumonkey 10y agojust in case, https://mridgers.github.io/clink/ https://mridgers.github.io/clink/ only 600kb to enjoy your sanity back
- b34r 10y agoWhy even make batch available? Just make PowerShell th default and be done with it.