TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How bad is the Windows command line really?

135 pointsby momo-reinaalmost 9 years ago

18 comments

nearalmost 9 years ago
It&#x27;s really, really, <i>really, really</i> really bad.<p>It doesn&#x27;t even have a logical history. Despite having used it for many years, I still don&#x27;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 <i>down</i> from the new command-prompt to access the previous commands.<p>I can&#x27;t make the window more than 80-characters wide dynamically. (I don&#x27;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.<p>Copy-and-paste as well is just complete garbage that takes forever.<p>I have to dump batch files into a folder in PATH because there&#x27;s no alias support nor .profile startup script.<p>I can&#x27;t color-code the prompt separately for visibility. There&#x27;s no tab-completion. There&#x27;s no shell escaping backticks. On and on.<p>Batch scripts are just hopelessly broken. It really feels like we&#x27;re abusing the hell out of them to do things they were never intended to do. The language is closer to Malbolge than C.<p>PowerShell is a whole other can of worms. I don&#x27;t care for it either, but that&#x27;d be a separate discussion.<p>Bash on Windows sounded promising, up until &quot;Windows 10 only&quot; and &quot;doesn&#x27;t play nice with the regular Windows environment.&quot;
评论 #11889519 未加载
评论 #11890202 未加载
评论 #11889358 未加载
评论 #11890006 未加载
评论 #11890030 未加载
评论 #11889775 未加载
brudgersalmost 9 years ago
In computing, &quot;batch&quot; connotes long running processes in addition to &quot;script&quot;&#x27;s connotation of collapsing multiple commands into a single one. The seemingly redundant parsing by the Batch interpreter is a feature, not a bug.<p>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.<p>2. The Batch interpreter allows self modifying code.[2] In the early 1980&#x27;s when Batch was designed, sophisticated COBOL programmers might have felt right at home. Lisper&#x27;s were probably more hit and miss.<p>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.<p>In the days when abundant RAM and fast CPU speeds were prefixed with &quot;mega&quot; 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.<p>[1]: <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;906586&#x2F;changing-a-batch-file-when-its-running" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;906586&#x2F;changing-a-batch-...</a><p>[2]: <a href="http:&#x2F;&#x2F;swag.outpostbbs.net&#x2F;DOS&#x2F;0019.PAS.html" rel="nofollow">http:&#x2F;&#x2F;swag.outpostbbs.net&#x2F;DOS&#x2F;0019.PAS.html</a>
评论 #11888697 未加载
评论 #11889492 未加载
elchiefalmost 9 years ago
Powershell is garbage. .Net does utf8 by default but powershell, built on .Net, manages not to.<p>Try type utf8Encoded.txt &gt; out.txt in cmd.exe and posh. Cmd works and posh fs it up.<p>And after you do figure out utf8 encoding in posh, it&#x27;ll always add a BOM just to screw you
评论 #11888649 未加载
评论 #11888914 未加载
评论 #11888823 未加载
评论 #11888872 未加载
itayskalmost 9 years ago
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&#x27;t get the cure for polio analogy that&#x27;s in the article but I really think anyone that&#x27;s comparing shells should compare with PowerShell.
评论 #11888713 未加载
评论 #11890137 未加载
评论 #11888841 未加载
EvanAndersonalmost 9 years ago
I get perverse joy out of using the Windows CMD.EXE shell (and the earlier COMMAND.COM from MS-DOS). Yes, it&#x27;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.
评论 #11888577 未加载
评论 #11888804 未加载
jasonjeialmost 9 years ago
This isn&#x27;t completely related to Windows command line but I thought I would post it out here.<p>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.
评论 #11888690 未加载
kmiroslavalmost 9 years ago
Personally, 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&#x27;s more your thing.<p>I&#x27;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.
评论 #11889198 未加载
评论 #11889587 未加载
alkonautalmost 9 years ago
It&#x27;s absolutely laughable. But I&#x27;ve almost come to see this as a feature - It&#x27;s so terrible that no one relies on it or uses it. Bash in my opinion is overused.
mschuster91almost 9 years ago
I 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&#x27;re also developing on OS X which ships a horribly outdated bash (and other coretools).
评论 #11890048 未加载
tr1ck5t3ralmost 9 years ago
Its good enough to bypass UAC &amp; AV and run whatever you like.<p>You dont even need to give your software a &quot;.exe&quot; extension to run code.<p>Just rename a program removing its .exe extension, then call it from the command line. It will run!<p>Its perhaps better to compare dos BATch files with bash.
agumonkeyalmost 9 years ago
just in case, <a href="https:&#x2F;&#x2F;mridgers.github.io&#x2F;clink&#x2F;" rel="nofollow">https:&#x2F;&#x2F;mridgers.github.io&#x2F;clink&#x2F;</a><p>only 600kb to enjoy your sanity back
ams6110almost 9 years ago
I honestly feel like I am missing something. What is the current excitement about bash on Windows? It&#x27;s been available (and something I commonly use) via cygwin for years. And cygwin&#x27;s bash can run .exe binaries.
评论 #11889253 未加载
评论 #11889983 未加载
adzmalmost 9 years ago
I&#x27;ve just spent way too much time trying to get utf8 to work well on the command line, ugh.
b34ralmost 9 years ago
Why even make batch available? Just make PowerShell th default and be done with it.
tacosalmost 9 years ago
There are, of course, choices beyond Bash, Batch and PowerShell.<p>I&#x27;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...)<p>Doesn&#x27;t solve the IT admin scenarios PowerShell is good for but I don&#x27;t go there. And if I did, I&#x27;d use C# anyway. No need to learn a new language to loop and call objects, that&#x27;s solved.<p>With the .NET Core stuff, I&#x27;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.<p>As for the &quot;Windows command line&quot; (cmd.exe) well, it still sucks. Console2 plus Clink and ... well, you&#x27;ll still miss zsh on cygwin or what just works out of box on Mac... but, hey, it&#x27;s a start.
评论 #11888756 未加载
dingo_batalmost 9 years ago
The cmd.exe on Windows 10 is a significant improvement from older versions. So much so that it has become actually useful now.
评论 #11889940 未加载
sklogicalmost 9 years ago
Unreadable on mobile
评论 #11888352 未加载
评论 #11888913 未加载
评论 #11888786 未加载
YeGoblynQueennealmost 9 years ago
tl;dr: batch will steal your soul and sell your kids to the Great Old Ones&#x27; cultists. Bash is meh (the author doesn&#x27;t really know much about bash). User Powershell. Save the world.<p>... and it&#x27;s all true.