I just fell in love with PowerShell (aka Monad)
Unfortunately I had not experimented with Monad before. Yesterday our blog server got swamped with new posting on PowerShell blog, a little poking around revealed that Monad has been renamed to PowerShell. I couldn't believe my eyes, I had expected that it'd be remaned to Microsoft Windows Shell.NET 2007 Professional Edition :)
So feeling a bit guilty I installed it on a XP box and started poking around. So to see the help I tried the following
PS C:\> dir -?
NAME
Get-ChildItem
SYNOPSIS
Retrieves the child items <snipped>
DETAILED DESCRIPTION
Gets the child item(s) <snipped>
USAGE
Get-ChildItem [[-Path] <System.String[] >] [-Incl <snipped>
I was surprised to see the help looked like Man pages!! Moreover the .NET backbone raised its head (intentionally) when parameter types are shown as System.String. I loved the fact that most common shell commands like dir, del have been aliased to corresponding PowerShell (MSH) commands.
The help was huge and I just wanted to see the usage and I tried the following
PS C:\> (get-command Get-ChildItem) .definition
Get-ChildItem [[-Path] <String[]>] [[-Filter] <String>]
[-Include <String[]>] [-Exclude <String[]>] [-Recurse]
<snipped>
This proves the true power of a object-oriented shell. You can just use the fields/properties as in .definition!
I wanted to find large files in a folder which were not log files and I could do it as
PS C:\> get-item .\* -exclude *.log | sort Length -descending
Directory: Microsoft.PowerShell.Core\FileSystem::C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 3/7/2006 6:19 PM 1440024 img2-001.raw
-a--- 3/17/2006 5:37 PM 423589 FuncTest.zip
----- 10/22/2004 7:47 PM 294512 NTLDR
----- 3/25/2003 6:00 AM 278688 CMLDR
-a--- 10/26/2004 2:16 PM 145466 uiprestore.cmd
-a--- 10/5/2005 4:16 PM 141415 rss2.html
<snipped>
The other thing I tried out just bowled me over and I instantly made PowerShell my default shell. I wanted to rename a registry key and I was able to do it as follows
PS C:\> cd HKCU:
PS HKCU:\> cd 'HKCU:\Software\MyCompany\'
PS HKCU:\Software\MyCompany> ren MyProd MyCompany_org
PS HKCU:\Software\MyCompany> dir
Hive: Microsoft.PowerShell.Core\Registry::
HKEY_CURRENT_USER\Software\MyCompany
SKC VC Name Property
--- -- ---- --------
1 0 MyCompany_org {}
1 0 Licensing {}
So I was just able to use the registry seamlessly as the file-system, list keys using dir and delete using del!! Regedit RIP. I guess the next target of Team Foundation source control would be create a provider to integrate with this model.
I've just experienced the future of all shells and just wanted to share my excitement with fellow developers. This is one big success story for .NET
Comments
- Anonymous
April 27, 2006
In case others run across this - TFVC already has a provider - I even put up the source on GDN
http://blogs.msdn.com/jmanning/archive/2006/04/07/570810.aspx - Anonymous
April 27, 2006
The comment has been removed - Anonymous
April 27, 2006
The comment has been removed - Anonymous
April 29, 2006
I have to side with FenaianEMT on this one. The console needs standard hotkeys (CTRL-P, C, etc); it needs to have auto-complete (Tab is not really an alternative because you have to hit it constantly to know if it will work). - Anonymous
May 01, 2006
I guess the best response I can give you is to try playing with some of the Xterm applications and then come back and try the microsoft console window. But some simple questions: Why can't I drag to resize the console window? Is it really that hard to have it dynamically change the console dimensions as you drag? And it's just silly that it can't store the entire buffer of a console session. The font options are pretty weak. I could go on. I think intellisense would be a really good idea, but that was more of a suggestion for a totally new feature. I don't know of any such application that supports something like that. But there's no reason not to and many reasons it would be a good idea. - Anonymous
May 02, 2006
Fenian I agree that the console is not as advanced as it should be and the age is clearly showing. But have you tried PowerShell. Its way-way ahead of Unix shells. - Anonymous
May 03, 2006
Like I said, I played with Monad a while back. I'll have to download PowerShell and mess with it a bit. Monad did seem like it'd be really cool if I could spend the time to properly learn the ins and outs of it. - Anonymous
June 30, 2006
PingBack from http://www.john.se/blog/2006/07/01/searching-for-a-good-replacement-for-the-old-console-in-windows/ - Anonymous
July 14, 2006
In PowerShell I ran (dir *.exe).Count to see the number of executables in System32 folder in a Vista...