Riaan Lehmkuhl's Blog

Subversion, Progamming, Tips & Tricks and whatever else springs to mind.
16Dec

cat Command for windows

16 December 2009 10:24 by Riaan Lehmkuhl

The cat command is one of the most frequently used commands on Linux/Unix like operating systems. Needless to say it could also be very useful on your Windows system.

Here is the C# code to create your own cat command...

Program.cs:

using System;

namespace cat {
    class Program {
        static void Main(string[] args) {
            if (null != args && args.Length > 0) {
                foreach (string arg in args) {
                    if (System.IO.File.Exists(arg)) {
                        Console.Write(System.IO.File.ReadAllText(arg));
                        Console.Write(Environment.NewLine);
                    }
                }
            }
        }
    }
}

The usage should be mostly the same as with it’s Unix counterpart.

To learn more see The cat Command.

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments

1/26/2010 2:40:02 AM #

Indonesia Java International Destination

nice trick for windows, thanks for your imaginative idea

Indonesia Java International Destination United States

3/3/2010 3:30:20 PM #

cheap prada

in most cases it can be replaced by the operator '<' or transfer of the file name as an argument

cheap prada United States

3/4/2010 3:32:37 PM #

Kevin

For us non-programmers - Powershell does the trick too! Something like:

cat c:\sample.txt | findstr hellWorld

Kevin United Kingdom

3/10/2010 9:31:55 PM #

Armand Zysk

I have to tell that I like Windows 7. That OS runs very smooth. Even the 64 bit version runs smooth. When Windows Vista came out a lot of software wasn't adapted yet for 64bit. Even though 64bit was allready there when XP was the king. Now most prgrams has a 64bit version. Games also run better on Windows 7. It's almost like gaming on XP. Nice work from MS after problem Vista. And best of all, you don't need a high end <a href="http://comwares.be">system</a>.

Armand Zysk

3/12/2010 11:34:38 PM #

love calculator

Hello, I was looking on the net and I ran into your web site. Keep up the good work.

love calculator

3/13/2010 10:12:21 AM #

new game

Hi admin, good morning. Wonderful blog post. You have gained a new subscriber. Pls keep them coming and I look forward to more of your superb articles. Best regards, Hamid...

new game

3/13/2010 5:21:07 PM #

Henry Bolevice

Henry Bolevice United States

3/15/2010 5:47:20 PM #

colorado private schools

colorado private schools United States

3/15/2010 11:16:55 PM #

Mayhem

Once I started reading this post I couldn't stop until I was finished, despite the fact that it wasn't precisely what I have been searching for, was a nice read though.

Mayhem

3/16/2010 4:22:53 PM #

forex

I was looking for a good read about cat Command for windows. Searching in Bing I managed to find this great site. After reading this information I'm really happy to say that I most definatelly found just what I was searching for. I will make sure to bookmark www.lehmkuhl.za.net/.../...ommand-for-windows.aspx and come again more often . Thanks! Smile

forex United States

Comments are closed

Riaan Lehmkuhl


Me, a disorder of the brain that results in a disruption in a person's thinking, mood, and ability to relate to others.

Recent comments

Comment RSS

Thingies

Calendar And Month List

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Disclaimer & Privacy

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Privacy:
We use third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

Most comments

Cool Quote

I know that you believe that you understood what you think I said, but I am not sure you realize that what you heard is not what I meant. - Robert McCloskey