Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A good opportunity to remind everyone that we finally inboxed curl into Windows 10, so this works (with color output) from a stock Windows command prompt.

Better late than never, I hope.



No need for that. You can do this:

     (Invoke-WebRequest -Uri wttr.in).content
from Powershell. Why not use the happy path?


Serious question -- not a flame war :)

I honestly can't tell if this is sarcastic or not. I've been typing `curl -O http: ...` into command prompts for decades, and that Powershell incantation looks awfully unwieldy.

In what way is it the happy path?


Like others have said, you would never type that long thing in Powershell, just `irm wttr.in` (even shorter then curl).

People for some reason always show long stuff that is only used when you write scripts to share with others and not interactivelly - you could do the same with curl if you use --long-parameter-names but somehow people are biased when talking about posh like aliases and other things do not exist.


Because it's the native Windows answer. There's no need to make Windows look like Unix. It's great (really!) the way it was designed.


Any good resources for using Powershell? Is there ever a reason not to use powershell? Coming from OSX it doesn't really make sense to me that there are two terminals installed by default, and I end up just using WSL ubuntu. Also I don't really know the commands so it feels crippled to me (no ssh (still? idk), not many tools, etc)


> Is there ever a reason not to use powershell?

No, you should always use it.

Its maybe a problem when ultimate performance is in question, but you can go long way with Powershell - I recently had a web service SOAP client implemented in it that did millions of requests in an hour using threads in less then 50 lines of code consuming less then 3% of server resources (running entire country in single day actually)

> I end up just using WSL ubuntu

You can have basiclly anthing working without WSL (except maybe docker correctly).

> Also I don't really know the commands so it feels crippled to me (no ssh (still? idk),

SSH is there. Learn commands along the way. You should def take a book like this one: https://www.manning.com/books/learn-windows-powershell-in-a-...

> not many tools,

All usual tools, linux and windows, can be used. You have majority of them hosted on chocolatey.


Do you feel like you are typing a lot more for simple things like this?


Powershell comes installed with a lot of aliases.

Invoke-WebRequest is just iwr


Can't speak for that person, but I'm certain it was sarcasm.


Maybe it's just me, but I find PowerShell to be so verbose.

Why does every parameter have to have consist of a camelcased sentence? I'm a good typist, but I don't think what you wrote is better than

    curl wttr.in
But that might just be (my) programming.


PowerShell can be shorter by 1 character for this use case:

  irm wttr.in
irm is an alias for Invoke-RestMethod which is similar to Invoke-WebRequest but better for non-html responses like json or plain text.


It's case insensitive and there are short aliases for commands. I live in Linux, but used it way back when. It's an object oriented shell that is kind of awesome and intuitive. Bash is great and you can get shit done, but i don't think it's as user friendly as powershell.


Honestly PS feels like yet another cryptic language with irregular/nih naming of functions and arguments (like AHK which is great, but invented its own megacryptic irrational language instead of taking something generic, and now you have to google every damn thing). If I programmed for PS, then okay, but seriously, Invoke-Rest-?Method, -Uri/Url, .content — how much semantics do you learn until you give up? I’d better

  http.get(url="...").body
in my console rather than this Invoke-WhatEver thing, because at least it seems programming language-y and names are consistent with all other web software.

Ed: strictly speaking, URI is not even a thing that you pass to a web request. I bet that IRM couldn’t fetch urn:isbn:0451450523.


> my console rather than this Invoke-WhatEver thing, because at least it seems programming language-y and names are consistent with all other web software.

Because curl is consistent?

> urn:isbn:0451450523

Curl can't do whatever this is either?


Because that seems programming language-y and names are consistent with all other web software.

>Curl can't do whatever this is either?

Right. This is a valid URI, which Invoke-RestMethod uses as a parameter name (-Uri) and which is a unique id for a resource and not its location (it could be, but not in this particular case). They should not have call that argument “URI”, if what they actually do is fetching from a URL.


This works great from the new Windows Terminal (using PowerShell 7):

  Invoke-RestMethod http://wttr.in
For some reason they recommend that early in the readme, but not down in https://github.com/chubin/wttr.in#windows-users where they discuss various issues on Windows.

EDIT: I see now that lzybkr already suggested using the even shorter alias `irm` for `Invoke-RestMethod`. Nice!


This handy function will ask and remember the city:

https://github.com/majkinetor/posh/blob/master/MM_Sugar/Get-...


Even easier with Invoke-RestMethod wtte.in


Glad to hear that, though I wasn't aware color output now works on windows command. I was under the impression the ansi.sys driver or similar was still necessary for color support.


My team shipped the next generation (after ANSI.SYS) of VT support with the first release of Windows 10 back in 2015. We keep adding things to it, trying to make sure we stay compatible with Xterm. It really is a different landscape now :)

The console subsystem is open-source at https://github.com/microsoft/terminal. Feel free to file bugs, complain, or what have you. That’s what we’re here for!

To quote GP, “better late than never, I hope”.


Is there anyway to get the new terminal working on Windows 10 LTSC? It seems as though a newer version of Windows is required. A backport maybe?


Unfortunately, we’ve got a couple dependencies on platform features that first shipped in 1903. Whether we can divest ourselves of those dependencies has been the topic of significant discussion recently! No promises, but we’ll do what we can.


[flagged]


Aw, come on. It was interesting and obviously well intentioned. Please don't be an asshole on HN; disincentivizing people from sharing things they've worked on is strictly negative for this site.

https://news.ycombinator.com/newsguidelines.html


Windows is fairly transcendent in our culture, like it or not. It’s not Joe’s-10-person-company-not-relevant-to-99%-of-readers.


I don't think we need to hear about new Windows features on HN posts because they both mention cURL. GP is just taking the chance to advertise.

It's like if they commented on the Mac OS X announcements saying "Look, Windows can count to 10 too!"

Off topic, against the rules, flag it.


I’m an open source advocate, but still appreciate that Windows is the most used PC operating system on the planet. The fact that you can use the tool ITA as it’s presented on stock Windows (when this is a recently added feature) is relevant info that’s useful to readers and I highly doubt parent intended it in any way to be an ad.

Not to put words in his mouth, but he’s probably just proud to have some influence on making Windows users’ lives a little easier and it would be an odd thing for him to expect people familiar with curl to suddenly become Windows partisans just because they’re now prepacking it (or generally for any Microsoft engineer to have much personal interest in convincing end users to adopt Windows personally).


This is supremely relevant though. The docs basically say "It's supposed to work like X, but for Windows you need to do ABCEDFGHIJ". OC is just "Actually, X works on windows now."

This comment is rude, inaccurate, and not in line with the rules of HN.


Isn't Windows 10 free?


No, it's priced into most computers. Retail costs over $100 last I checked (and more for pro), though OEMs pay cheaper prices for that sort of volume. There are also sketchy keys available for ~$20.


Sort of? You can install without a key, and other than a little 'watermark' in the corner of the screen (and being prevented from changing the wallpaper) it will get updates and work normally.


there are ebay keys for a couple dollars


For the life of me I cannot understand why would anyone waste their money on such keys. Usually those are volume licenses being sold separately, which is not legal and does not provide you with a valid license. If one is intent on breaking the law anyway, one can save those two bucks and use of the many safe activation methods which do not require installing anything on your machine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: