TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A Saner Windows Command Line

147 点作者 japaget大约 9 年前

26 条评论

diego_moita大约 9 年前
To hear bash-people to call Powershell &quot;non-intuitive&quot; 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.<p>Bash and Unix commands are only &quot;intuitive&quot; after years of practice; Powershell is not different. And it doesn&#x27;t have any obligation of being equal to bash.
评论 #11390390 未加载
评论 #11390099 未加载
评论 #11389492 未加载
评论 #11390472 未加载
CraigJPerry大约 9 年前
Powershell and its long winded cmdlets are really hard for me to like. I always fall back to cygwin on windows.<p>I once wrote a PS script to set some power management options on a corporate laptop. The script was 11 lines long (vs 3 lines in Python), it was harder to read and understand. Even with ISE available it was much harder to write.<p>I followed along with some exchange server tutorial where the prescribed easy way to achieve the task was a completely unintuitive PS script. I kept thinking about how much easier that particular config change was to make on a Linux host running postfix.<p>I can&#x27;t see what benefit PS has over cygwin bash but I&#x27;d love to hear ideas because PS comes installed out of the box where I have to install cygwin myself.
评论 #11389345 未加载
评论 #11388720 未加载
评论 #11388755 未加载
评论 #11388963 未加载
评论 #11388752 未加载
评论 #11388936 未加载
评论 #11389012 未加载
评论 #11389792 未加载
rottyguy大约 9 年前
&gt;&gt; Let&#x27;s be honest. What many people think of as &quot;the default Windows command line&quot;, 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.<p>Funny, from a guy coming from Windows to Unix I think the exact opposite. Each command comes with a bazillion options and the defaults are simply atrocious (to read the man, oy). Yes I understand that you can tailor each command in some startup script but why? It almost feels like every command needs to be created to solve 5 million things when 99% of the time you use it for 1 or 2 things. A few of my favorites:<p>Scripting:<p>A = 123 vs A= 123 vs A=123 should be the same!<p>Please use trim() in your program when parsing tokens!<p>Keyboard:<p>Please, for the love of god, make the keyboard behave like a keyboard. I don&#x27;t want to be logged into some terminal and have the Backspace not behave like a backspace (^H??). Yes, I&#x27;m sure I can make it work via some, again, configuration magic or enter emacs mode, but, again, why?<p>cd.. should just work.<p>&lt;&#x2F;rant&gt;<p>Having been on unix for the last 7mo after years of windows, I do like some things but let&#x27;s not be too quick to call the kettle black.
评论 #11389043 未加载
评论 #11389238 未加载
评论 #11389024 未加载
评论 #11389068 未加载
评论 #11389379 未加载
评论 #11389427 未加载
评论 #11390407 未加载
评论 #11389410 未加载
Pxtl大约 9 年前
At our office we jokingly refer to powershell as &quot;two googles per line&quot; - a term coined by its strongest proponent at the company.<p>It thought it would come naturally over time, but it never does. It seems needlessly cryptic and verbose in so many ways. I&#x27;ve started using LinqPad for stuff I would normally do in cmd now.
评论 #11388794 未加载
评论 #11388703 未加载
评论 #11388902 未加载
hobs大约 9 年前
I think a lot of the hate on powershell is that it chooses to do things very similar to existing languages, but just different enough to confuse practitioners of anything else.<p>Posh also suffers in its somewhat easy to invoke any .NET library, so people start comparing it to a more tooled programming language or something with more sane libraries, and the &quot;ISE&quot; is nowhere close to an IDE (why isnt powershell a first class citizen in visual studio! yes I know there are tools, they are not great.)<p>Nonetheless, after a few years of working in sql server I have adopted more and more posh in my life because its simply the fastest way to get things done if you are doing windows server management.<p>I usually find myself on one of these two places if I am looking for something:<p>Mike Fal (SQL Server focus, he is great) <a href="http:&#x2F;&#x2F;www.mikefal.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.mikefal.net&#x2F;</a><p>Hey Scripting Guy! <a href="https:&#x2F;&#x2F;blogs.technet.microsoft.com&#x2F;heyscriptingguy&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.technet.microsoft.com&#x2F;heyscriptingguy&#x2F;</a><p>edit: forgot to mention that MSFT helped to cause problems by massive changing how the language did things over time(usually for the better), so ps1 vs ps4 is crazy different, another reason to be annoyed because which version comes with which product is a fun skew to deal with (thanks sqlps having ps2.0!)
Poiesis大约 9 年前
I don&#x27;t really care about &quot;It&#x27;s Just Text&quot; vs &quot;Data Typing FTW.&quot; There are different tradeoffs at play here, and to my mind that&#x27;s ok. I&#x27;m just thrilled to have <i>something</i> that&#x27;s: - Internally consistent - Well documented - Available by default - Full featured - Still being improved<p>Sure, I&#x27;m not thrilled with having to learn another language to get anything done. But it&#x27;s so much better than what came before that I don&#x27;t care. Besides, Bash and friends certainly have their quirks as well.
gpvos大约 9 年前
I tried both ConEmu (twice) and Console2 in the past, but both were too unstable for regular use. If someone can convince me that the situation has markedly improved, I might try again, but I guess I&#x27;ll just wait until we upgrade to Windows 10 at my workplace (which they say is any day now).
评论 #11388850 未加载
评论 #11388904 未加载
评论 #11389200 未加载
评论 #11389124 未加载
评论 #11389063 未加载
评论 #11388861 未加载
评论 #11389265 未加载
agumonkey大约 9 年前
No mention of clink ? surprising, cmd.exe meets readline. Highest ROI &#x27;update&#x27; I know on Windows <a href="https:&#x2F;&#x2F;mridgers.github.io&#x2F;clink&#x2F;" rel="nofollow">https:&#x2F;&#x2F;mridgers.github.io&#x2F;clink&#x2F;</a>
评论 #11389045 未加载
andkenneth大约 9 年前
Most of my issues with windows command line have been solved by installing the unix tools to the path when installing git. Provides most of the commands I need (including a native ssh that works from the windows+r dialouge) and I have mingw if I need to do something with bash itself.<p>This on windows 10 with it&#x27;s nice new command window is pretty nice, but I still do anything serious on my macbook.
SeanDav大约 9 年前
&gt; <i>&quot;And, purely subjectively, I think the .ps1 syntax is a lot more readable than the old .bat syntax.&quot;</i><p>The Author does say &quot;subjectively&quot; but in my experience, both personally and with others, the reverse is true. Powershell can seem to be really cryptic.
评论 #11388727 未加载
emodendroket大约 9 年前
I guess it&#x27;s heretical to say this in some circles but I really like PowerShell, despite its faults. An object-oriented shell is a really good idea that saves a lot of time trying to munge texts with regular expressions and such.<p>That said the return semantics stink.
lolive大约 9 年前
Git for Windows is bundled with Git-Bash. A very Linux-like commande line. Works like a charm.<p>I also use MobaXTerm as my Putty replacement. It also comes with a Bash terminal that works fine. Very handy!<p>(Two reasons why I love to have learnt Bash)
评论 #11389978 未加载
maratc大约 9 年前
&gt; <i>One of the reasons you use Windows is so you don&#x27;t have to use the command line.</i><p>It&#x27;s the other way around: One of the reasons I <i>don&#x27;t</i> use Windows is because I <i>have</i> to use the command line.
ohitsdom大约 9 年前
I develop on Windows and use cmd.exe daily (for simpler tasks like running Gulp or PhantomJS). It&#x27;s hard to overstate how much of an improvement Windows 10 brings to the command line. Keyboard cut and paste, resizing, better text selection seem so wonderful. It&#x27;s a crime it took Microsoft this long for these simple features.<p>There&#x27;s also other handy improvements, like typing &quot;cmd&quot; into the file explorer location bar to open a command window to the current location you are viewing.
评论 #11389181 未加载
bediger4000大约 9 年前
<i>One of the reasons you use Windows is so you don&#x27;t have to use the command line. But sometimes it&#x27;s unavoidable—maybe you need to do some advanced git-wrangling, or you&#x27;re developing in an environment with CLI-based tools that are far more mature than their GUI counterparts.</i><p>This viewpoint is just plain wrong. Since GUIs typically don&#x27;t have a way of doing sequences of commands other than clicking and waiting, then clicking again, or of automatically making decisions, the biggest reason to use a CLI would be to express things that you can&#x27;t with a GUI - like anything that requires a flow-of-control with if-then-else.<p>After all, that&#x27;s one of the reasons that rebuses are fun - they&#x27;re indeterminate and it&#x27;s fun to de-ambiguate them. It&#x27;s less fun to have to do all de-ambiguation yourself, when a simple pipeline or while-loop would do the trick.
jug大约 9 年前
I think Powershell is a huge leap beyond Command. I just wish scripting was easier with it, speaking of its return values: <a href="http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;10288256&#x2F;9744" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;10288256&#x2F;9744</a><p>Maybe there are better programming patterns for me to use here. Coming from traditional imperative languages, I was confused though, especially when I got to nests of functions, return values, and debug outputs. I mean, I later understood why things worked like they did -- I just had a hard time wrapping my code around the philosophy. Which is unusual for me to have with a language from Microsoft in their post-.NET era.
jupp0r大约 9 年前
&gt; I know what you&#x27;re probably thinking. One of the reasons you use Windows is so you don&#x27;t have to use the command line.<p>I know what I&#x27;m thinking. One of the reasons I don&#x27;t use Windows is that its command line is a second or third class citizen.
评论 #11389580 未加载
latkin大约 9 年前
I did Windows dev exclusively for a long time, and was an early Powershell adopter. Recently I switched companies and now I swap back and forth from Win10 (PS v5) to OSX (Terminal). I&#x27;m massively more productive in Powershell, mostly due to my inexperience with Unix. There are a few things I think I can legitimately argue, though:<p>The power of the unix command line is mostly from the utility commands themselves, not from the shell language&#x2F;ecosystem. Nobody seems to be super enthusiastic about bash as a language (see all of the &quot;at this point I just go to perl&#x2F;python&#x2F;etc&quot; comments), but the commands themselves are super powerful and flexible. If you put in the time to really learn the commands and their flags, you can do quite a lot. Watching experienced unix users at the prompt, I routinely think &quot;oh nice, that&#x27;s a great command to have&quot;, but rarely &quot;oh that&#x27;s a handy language feature&quot; or &quot;wow Bash made that really easy&quot;.<p>With Powershell, it&#x27;s kind of the opposite IMO. The language and ecosystem are mostly well-thought-out, consistent, and powerful. Everything-is-typed, pervasive and awesome tab-completion, mature pipeline system, decoupling of data and how it&#x27;s displayed, access to the .NET standard libs, ease of extensibility and scripting (oh god it&#x27;s so nice never neededing to parse arguments!), reflective help system and discoverability features, easily hostable in other apps... That all comes from the ecosystem. Where Powershell often falls flat is the limited set of built-in commands, or the lack of sensible flags&#x2F;options for those commands which do exist. You&#x27;re often falling back to legacy cmd.exe-era executable utils, or invoking some .NET API, both of which result in more verbose, awkward code. e.g. reading&#x2F;writing the registry is SUCH A PAIN with powershell builtins (why?!?!?), so reg.exe it is. Much of that comes from Powershell&#x27;s relative youth (the set of builtins and their flags is still evolving), and the relative script-unfriendliness of Windows as an OS compared to unix.<p>So for a particular action, in unix you have have a utility (or even N utilities) with 15 arguments to handle 95% of possible cases, in Powershell you&#x27;ll get a cmdlet with maybe 5 or 6 arguments that handles 75% of cases, but the output is an object so the remaining 25% can be done by calling some method or grabbing a field. Both approaches have their strengths and drawbacks. The Powershell approach tends to scale better, I&#x27;d say - you can create fairly large scripts&#x2F;packages in pure Powershell without needing to bail out to Python or C#.
gr3yh47大约 9 年前
&gt;Upgrade to Windows 10... the benefits really can&#x27;t be overstated.<p>except that there&#x27;s tons of drawbacks to counteract said benefits. Privacy notwithstanding, power-use has been fractured and the flow of configuration ruined in 10
alimbada大约 9 年前
I&#x27;ve been wanting bash style completion in a Windows Command Line for so long. Big thanks to the author for the PSReadLine tip; it works perfectly in ConEmu whereas Clink wouldn&#x27;t work at all.
joewrong大约 9 年前
<a href="http:&#x2F;&#x2F;scoop.sh&#x2F;" rel="nofollow">http:&#x2F;&#x2F;scoop.sh&#x2F;</a> has been a nice-to-have tool, similar to homebrew on osx
dolguldur大约 9 年前
anybody tried cash [0] ?<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;dthree&#x2F;cash" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dthree&#x2F;cash</a>
kuma4大约 9 年前
I didn&#x27;t expect there were a lot of people who knew well about PowerShell here. I like PowerShell.
ezoe大约 9 年前
I don&#x27;t use Windows anymore so I don&#x27;t care much. But, When does Windows offer a terminal emulator with sane character encoding(UTF-8)?<p>This is 2016, CP932(Shift JIS with IBM extension) shall be abandoned.
tkubacki大约 9 年前
Windows is no go for me as long as there will be no option to use ansible from cmd - fortunately you can manage windows box from OSX or Linux box with ansible
ekianjo大约 9 年前
Why would you even want to make Windows command line better, instead of using a state of the art command line of Linux via a VM running in Windows, if you really cannot escape the Windows realm ?
评论 #11388847 未加载
评论 #11389103 未加载
评论 #11389107 未加载