Navigation

Search

Categories

On this page

Archive

Blogroll

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

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 120
This Year: 1
This Month: 0
This Week: 0
Comments: 40

Sign In
Pick a theme:

# Tuesday, August 16, 2005
Tuesday, August 16, 2005 11:58:36 AM (Mountain Daylight Time, UTC-06:00) ( )

My attempts to create a quick way to access google search have met with failure. It seems that using a simple Batch script is insufficient to handle 'special' characters like the pipe '|' or arrows '>' & '<'. These are generally something a geek coder may need to search for. I got off my lazy butt and coded a quick console app in C#.

Complile, copy to your %userprofile% folder, and enjoy.

USAGE ~ [WINKEY + R] -> gs <word1> <word2> <wordn>

GS.cs

 

namespace genericsearch
{
    class gs
    {
        static void Main(string[] args)
        {
            if(args.Length == 0) {
                System.Console.Error.Write("Use: gs.exe <word.1> <word.2> <word.n>\nPress any key to quit");
                System.Console.Read();
                return;
            }
            string query = "";
            foreach (string s in args)    {query += s + "+";}
            query = query.Remove(query.Length-1,1);
            string queryURL = System.Configuration.ConfigurationSettings.AppSettings["searchURL"];
            string process = queryURL + query;
            System.Diagnostics.Process.Start(process);
        }
    }
}

app.config


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="searchURL" value="http://www.google.com/search?q=" />
    </appSettings>
</configuration>

Comments [0] | | # 
Comments are closed.