views:

360

answers:

9

The command line has eluded me for years. I started in 1999 so I was already spoiled by the GUI; using my good ol' mouse to point and click away. Ten years later and I have some basic command line statements under my belt: cd, dir, rm, ipconfig, etc. Outside of that not much else. Heck, even my keyboard shortcuts are fairly limited to: copy, paste, cut, refresh browser; but I guess that's a different topic alltogether.

Now I also see something called "Windows Powershell". It appears to be more powerful than the cmd.exe and is geared towards system admins -- cool. I, however, am a Web Developer: everything related to ASP.NET basically. I live in Visual Studio when it comes time to bang out code.

Would a developer like me gain anything from incorporating the Windows shell into my daily workflow? As I get older I'm more interested in function over form, i.e - recently purchased a ThinkPad and exclusively use the TrackPoint :) I'm all about using a straight line to get from point A to point B.

What say you about my situation and to Windows developers in general?

+10  A: 

Command-line scripting can be very useful, even in the Windows environment. Scripts can be useful for automated deployments, and monitoring purposes. Unfortunately, the default "cmd.exe" interface and commands are a bit clunky, so it's not as fun to work with as Unix-based shells. Powershell is a huge improvement over cmd, so I'd recommend learning the basics of Powershell, and see if it would be useful for you.

Andy White
+3  A: 

There are advantages to each, so I would recommend you learn Powershell, at least enough to get a sense of whether it can help in your situation. I've found that if a GUI doesn't support repetitive operations well, a rich commandline user interface like Powershell can really speed them up. And sometimes it's very refreshing and educational to strip away all the wizards and get familiar with how things work at a lower level.

Jim Ferrans
+2  A: 

There are some cases where it can be useful for quickly automating some small tasks. For instance, I use a batch file to package Firefox extensions into XPI files. But other than that the only time I really use it on Windows from a development standpoint is building third party libraries that only have Makefiles.

From a sysadmin standpoint it can be really useful, because you can quickly access a lot of system features that would otherwise require time consuming navigation of Control Panel windows. Starting/stopping services, managing the firewall and other security features, etc.

Gerald
+2  A: 

If you...

a) work with files

and

b) do the same thing on files more than once

...you can probably save yourself time by learning batch or command line.

I generally have 3 cmd.exe shells open at all times. One for building ('make release platform'), one for greps, one for anything else I have to do. If you do any mass deleting command line is much more efficient, and anything you do on files often should be automated with .bat as much as possible.

I haven't used powershell but it seems to be a good improvement on batch, which is quite limited. When I need more power I typically switch to Python.

Dan Olson
+2  A: 

It depends on the kind of work you're doing.

  • If you are focused only on development itself, you may not have much use for Powershell.

  • If you also have to take care of stuff like deployment or user support, it may help you a lot.

Have a quick look at this question to get an idea of what you can use Powershell for.

Treb
A: 

Command line is very powerful weapon. In Powershell you can use .NET languages for creating your scripts.

I recommend cmd tools from Server 2003 Resource Kit (In Windows Vista are default, I think).

Windows Server 2003 Resource Kit Tools

And I use cmd line and PowerShell for automatization some operations, when I deploying my applications.

MicTech
+5  A: 

Unix developers have leveraged the command line for decades. PowerShell with it's deep integration to the Windows platform and products (Excel et al) enable automation of many of our daily chores.

Andy White highlighted several key areas where PowerShell is more than handy.

Check out PowerBoots and some of its uses similar to Tcl/Tk and inspired by Ruby Shoes.

Doug Finke
A: 

If you plan on taking advantage of Velocity (a distributed caching solution from MS), you will need to learn PowerShell, as that is the only way to configure it.

Configuring IIS in a consistent manner is another plus for PowerShell.

Steven Murawski
+2  A: 

As a .NET developer I find PowerShell very useful. I use it as an interactive .NET REPL. Rather than write small console apps to experiment with .NET types I can frequently just try my experiment from the PowerShell prompt. For instance, say I want to figure out which particular formatting string I want to use for a DateTime object:

PS> "{0:R}" -f [DateTime]::Now
Mon, 13 Jul 2009 11:15:34 GMT

And as others have mentioned, if you do any sort of repetitive tasks it is well worth the effort to learn PowerShell so you can automate those tasks. Repetitive tasks are prone to error and can literally hurt you (ie RS injuries). Take for instance, cycling through all your source and deleting all bin and obj dirs:

PS> dir . -r | 
    where {$_.PSIsContainer -and $_.Name -match '^(bin|obj)$'} | 
    remove-item -r -whatif

PowerShell can also easily slice and dice XML and WMI info from your PC. Want to find out your BIOS info:

PS> Get-WmiObject Win32_BIOS

Want to see how many memory slots are open in your computer (without taking off the cover):

PS> gwmi Win32_PhysicalMemory | 
    Format-Table Description, DeviceLocator, Capacity -auto

Also, since the PowerShell engine is easily hostable, it is worth looking at using as a scripting environment from your apps. If those apps are more like sys admin apps, this makes a lot of sense. OTOH for more traditional scripting, I would probably host the IronPython engine.

Keith Hill