Saturday 4 September 2010

Cygwin? Hold on...

I know I had promised in my last post about Cygwin and basically show you how this would work. However due to me not quite getting it just right for you guys I thought I would throw you a little piece of something in the meantime.

C# is also my fave tool for various reasons. Especially the Visual C# Express Edition by Microsoft that has made things easier for almost anyone to code.

The flip side is I now miss using the Borland (Embarcadero) Tools that were around. Microsoft has really taken this RAD methodology far by finally realising that this was how to get people enthusiastic.

Anyway one of the questions that most IT Admin's would love to do is make their jobs easier. If you know programming then it becomes even more easier, however what do you do if you have a tool that does a job and you want to write another tool that you don't want other administrators messing up by accident.

Well sometimes wrapping things in a executable helps. But how do you run an executable that is OS specific in C#?

Well meet System.Diagnostics

It has a class there called Process.

This allows you to define a way of running an external application without finding out a way of writing a interface and things.

So how would this look?

Well people here is a simple example given below that will launch notepad using just a few lines of code.

using System;
using System.Diagnostics;

namespace RunNotepad
{
    class Program
    {
        static void Main(string[] args)
        {

            // Define an object called p which will create our process.
            Process p = new Process();

            // Define the application that you want to run. Don't forget to escape the '\' as these are special.
            p.StartInfo.FileName = "C:\\windows\\notepad.exe";

            // Start the process to run.
            p.Start();
        }
    }
}

Thursday 2 September 2010

Cygwin

So the tool I was mentioning is Cygwin.

A very useful tool for you Linux heads out there. Also very useful to the Windows System Admin especially when trying to fix QoS issues with VoIP phone software as the ping application for Linux is a lot better at times than the built in windows one.

I will show how to use this very useful app in my next post but it goes a long way in making your life a lot easier as you begin to work smarter not harder.

So the next post will take you down why it is better than say having a VM on your machine at times.