Cowsay in Powershell

2013-08-03

I’ve been working on a command-line installer for Windows called Scoop, and I wanted to have some interesting programs to demo it with. Cowsay seemed like an obvious choice.

 ------------
< Try Scoop! >
 ------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

So I wrote Cowsay in Powershell, trying to follow the functionality of the original Perl version as closely as I could. Afterwards I found that John Kane had already done a PS port—so I’m not the only one who considers this an essential program for the Windows command-line.

There are some benefits to using my version though—it supports (or at least tolerates) the same parameters as the original, so you can use cowthink, change the eyes, pipe your message from another program or specify one of 46 built-in cowfiles (or even use your own).

$ "Powershell!" | cowthink -f daemon
 -------------------
( Powershell! )
 -------------------
   o         ,        ,
    o       /(        )`
     o      \ \___   / |
            /- _  `-/  '
           (/\/ \ \   /\
           / /   | `    \
           O O   ) /    |
           `-^--'`<     '
          (_.)  _  )   /
           `.___/`    /
             `-----' /
<----.     __ / __   \
<----|====O)))==) \) /====
<----'    `--' `.__,' \
             |        |
              \       /
        ______( (_  / \______
      ,'  ,-----'   |        \
      `--{__________)         \/


If you’d like to try it out, you can install Scoop and then run:

$ scoop install cowsay