lyon-smith.org

The Lyon-Smith family web site.
Welcome to lyon-smith.org Sign in | Join | Help
in Search

Browse by Tags

All Tags » powershell
  • Arrays in PowerShell

    While I'm waiting for some files to copy around I thought I'd record my recent PowerShell learnin'. Somtimes a command, like Get-ChildItem can return either an array of results or just a single one.  You can use the @ symbol to cast the result into an array, so:(gci -i *.txt).Count Sometimes returns nothing, whereas:@(gci -i ...
    Posted to code-o-rama (Weblog) by john on October 23, 2007
  • Line Count with PowerShell

      Starting to get the hang of PowerShell.  Today I wanted to quickly count the number of lines in some source code.   There's a simple implementation and then there's a better one.  In the end I settled on:$count=0;gci . -i *.cs,*.cpp,*.h -r | %{$count += [System.IO.File]::ReadAllLines($_.FullName).Count};$count Which is ...
    Posted to code-o-rama (Weblog) by john on October 22, 2007
  • More PowerShell Fun

    Still struggling to gain traction with PowerShell.  I've stopped myself running the CMD prompt by default, and I've installed it on all my test VPC machines. Firstly, I recommend you download the Windows PowerShell Graphical Help File.  It's an old school .chm file, but you can search it.  Don't underestimate how useful this is ...
    Posted to code-o-rama (Weblog) by john on October 17, 2007
  • Adventures with PowerShell

    I've held off moving to Windows PowerShell.  The reason is that I came up with a solution for running C# source directly from the command line as script a few years ago using CodeRunner .NET, and I've haven't had a pressing need for more functionality.  But I decided that the time has come to say goodbye to the ...
    Posted to code-o-rama (Weblog) by john on September 26, 2007
Powered by Community Server, by Telligent Systems