Tuesday, September 14, 2010

Tips:Open the application by finger tips


Have you ever wondered why typing cmd and enter opens the command prompt window, typing notepad opens the notepad editor, typing iexplore opens the internet explorer, typing mspaint opens Microsoft paint and so on. Do you know why this is happening?

What do you think, is this only possible with some of the thing for which operating system has given us command? Of course not , think like type o and your outlook is opened, type I and your internet explorer is opened, type f and your Firefox is opened, type w and your  Microsoft word is opened and literally anything you like to open .

This is of course possible. Here is a tip. 

Have you ever heard of Environmental Variable, if not don’t worry.

If I ask you a question how do you open (execute) a particular file or application. The answer is simple, go to the location where the application or file is and click on it. Exactly the same happens when you type cmd and enter or type notepad and enter.

Maker of Operating systems are very smart, what they have thought is, if you want to open anything either you need to do these thing
1.    
  1. Go to the location and open it
  2. Don’t go to the location and open it

Second statement is confusing, isn’t it but it is true. For this to happen they have given us a provision. They have given a text box where you enter the path of all application or files you want to open separated by semi colon. When you type and enter we will look on the present working location and if it is not found then we will look at this text box path and open it .This is known as environment variable concept.

How to open environmental variable:

Right click My Computer->Properties->advanced tab ->Environmental variable button this will open the Environment variable window




See the System variable section Path is highlighted, that has the collection of all the paths. C:\windows\system32 is default there that is why when you enter cmd and click enters, it opens the cmd.exe available in C:\windows\system32 location.

We need not to go to C:\windows\system32 and the click on cmd.exe to open the command window. Think about the pain if this functionality is not there.

Now I am going to create some batch file and show you how type i and your Internet Explorer is opened.

Here are the steps:

1.    Crate a folder in C driver and name it  BatchFiles ( C:\BatchFiles)
2.    Go to BatchFiles folder and create a notepad
3.    In the notepad enter the following lines of code

@echo off
cd C:\Program Files\Internet Explorer
iexplore.exe

4.    Save it as i.bat
5.    Go to the Environment variable window and in system variable Path enter the created folder path
i.e. (C:\BatchFiles) in Path variable (all location is separated by semicolon)

(How to open Environmental variable -Right click My Computer->Properties->advanced tab ->Environmental variable button)
6.    Click on OK button 

Now you are all set to execute it.

Click Start->Run -> type i and enter, wonder happened!!! Internet explorer is opened.
Note: i is same as the name of batchfile that is i.bat

Now what you need to do is create a notepad and enter the above code with the application location and exe name and save it as a batch file
------------------------------------------------------------------------------------
For excel – save as e.bat and enter the following code
@echo  off
cd C:\Program Files\Microsoft Office\Office12
excel.exe
For Outbool – save as o.bat and enter the following code
@echo off
cd C:\Program Files\Microsoft Office\Office12
outlook.exe
Note: you need to create the notepad file and enter and code and save it as batch, no need to go to environment variable window as you have already added it.

So if you want to open any exe of your project , creates the batch file of that and put the file inside the C:\batchFiles folder and enjoy

No comments:

Post a Comment