Hacker News new | ask | show | jobs
by drblast 4963 days ago
Seriously, MS has been going toward easy scripting for years:

http://en.wikipedia.org/wiki/Windows_PowerShell

And Powershell ISE is like bash with Intellisense.

You can access .Net from Powershell and pretty much do anything you want. You can easily write new commands in C#.

Everything you want is already there. You just have to step slightly out of the Unix mindset to find the Windows equivalent. And I'd have to say that the powershell idea of passing objects around instead of text is exceptionally useful.

1 comments

Whats an object? Some type of file?
I can best explain via example. Let's say I want to iterate through a directory and do something to each file:

  ls C:\ | foreach{echo $_.Name}
That will print out the file name. The $_ variable represents each file object that ls returns. Let's say I want the file creation times instead:

  ls C:\ | foreach{echo $_.CreationTime}
Or just the day of the week the file was created:

  ls C:\ | foreach{echo $_.CreationTime.DayOfWeek}
It's incredibly powerful. And the default is always a text representation of the object anyway, so it seems like text is getting piped, just like Unix. If you do this:

  ls C:\ | foreach{echo $_}
You get a typical directory listing.