Hacker News new | past | comments | ask | show | jobs | submit login

I thought powershell had to be explicitly installed/enabled even in win7.

I'm not going to walk a user through that when I can do what I want in batch (with more pain, but still less than ending up providing support...).

My normal area is Linux though, and both powershell and batch make me appreciate bash so much more. Even those little things like being able to format arbitrary dates as you want...




You thought wrong. It's installed and enabled by default.

> Even those little things like being able to format arbitrary dates as you want...

You mean like

    $someDate.ToString('yyyy-MM-dd')
    'Today: {0:yyyy-MM-dd}' -f (Get-Date)
    Get-Date -Format yyyy-MM-dd
    date -f yyyy-MM-dd
Right, that's excruciatingly hard in PowerShell (hey, you even get Unix date format strings with Get-Date -UFormat). (But I guess we just come from different worlds here, as every time I have to read or write bash scripts it makes me appreciate PowerShell so much more.) Granted, the batch variant is ... not as pretty:

    for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
    echo Today: %MyDate:~0,4%-%MyDate:~4,2%-%MyDate:~6,2%
And I found the PowerShell script alongside with the batch file a pretty workable solution. Nicer language and still something for clueless users to double-click.


Powershell is actually a really nice shell/scripting language. I often miss its power, simplicity and not to mention the immense amount of flexibility having all of .net accessible when using a 'nix box.


That sounds like a symptom of simply being more familiar with the Windows environment. People who have grown up in China probably find chopsticks simpler and more powerful than forks -- I'm hypothesizing -- but not because forks don't work.


I wouldn't say so. I would kill for a halfway decent Ruby shell. On Windows I'd be going on about the power of .net and on nix I'd be promoting how awesome having the power of gems in my shell is. Powershell really is quite good and blows sh/bash/zsh out of the water. The "everything is an object" model instead of passing around strings really changes how you work.


I know far more about scripting linux/unix than Powershell, so I can't really speak directly to Powershell's strengths and weaknesses. But there's reason to be skeptical that Powershell has actually blown bash out of the water, I think. If it made that much difference, linux/unix would have adopted Powershell's object paradigm for itself.

I'm not sold on Ruby gems. I haven't learned Ruby yet. Shell scripting to me means bash (or /bin/sh) + whatever utilities come standard on a unix system: sed, awk, etc.

The goals may be slightly different, reflecting the different cultures using the shells. What I think is cool about bash scripting is that I use bash constantly, anyway, which makes it easy to test small script fragments before including them in a full-on script, and even though, e.g., some things are nasty to do syntactically in bash, I get lots of practice.




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

Search: