Scott Forsyth's Blog

December 2006 - Posts

  • Clip - Saving command line and powershell output directly to the clipboard

    Every once in a while I run across something so simple, yet so powerful, that I wonder why I've never heard of it before.  Today I came across one of those situations.

    Within Windows Server 2003 and Vista, there is a command line and PowerShell parameter called "Clip".  This allows you to output the command line results directly to the clipboard.  This is great if you need to output a large result, or even if you want to save the hassle of selecting text and copying to the clipboard when you could have done it in a single step.

    It's very simple, just pipe (|) to the CLIP command.

    For example, let's say I want to get a list of all IP addresses on a Windows Server 2003 box. (the server has dozens of IP addresses)  In the past I would often pipe the results to a text file and then open the text file and save the results to the clipboard.  Not anymore!  The command would be like this:

    ipconfig /all | clip

    Now I have the detailed ipconfig in my clipboard to be pasted wherever I want.  This works with large files and large output too.  Be careful of course that you don't try to CLIP a 1000MB file! 

    Here's the help for clip:

    CLIP

    Description:
        Redirects output of command line tools to the Windows clipboard.
        This text output can then be pasted into other programs.

    Parameter List:
        /?                  Displays this help message.

    Examples:
        DIR | CLIP          Places a copy of the current directory
                            listing into the Windows clipboard.

        CLIP < README.TXT   Places a copy of the text from readme.txt
                            on to the Windows clipboard.

    And yes, I used CLIP to capture that help information, like so: clip /? | clip

    What about Windows XP users?  CLIP was not included in Windows XP but you can get it easily enough.  If you have access to a Vista or Windows Server 2003 computer, just copy the clip.exe file from C:\%windir%\system32 folder to your system32 folder.  It will immediately work as expected.

     

  • Tool: Creating a custom MachineKey in ASP.NET

    There are many times when it is worthwhile to create a custom machineKey for your web.config file.  This is worthwhile on a webfarm but also worthwhile on a stand-alone server so that your machineKey remains the same after an iisreset or application pool recycle. 

    I've put together a simple tool that will generate a valid random machine key.  It will create a validationKey and decryptionKey which you can copy and paste into your web.config file.  This is random so there is virtually no chance of anyone else having the same keys.

    I hope you enjoy!

    http://www.orcsweb.com/articles/aspnetmachinekey.aspx

     


Powered by Community Server 2.1