views:

154

answers:

8

Hi, I really don't know how to say, may be this is why I didn't found a solution on Google. My problem is simple. I want to run program from the execute command just by putting their names and not the path. For example type 'myprog' to open 'c:/program/myprog.exe' That's all! Thanks for your help :)

A: 

You have to put c:\program in your path. You don't say what operating system you're on but that's what you have to do in XP

GregD
+1  A: 

you have to set PATH = c:\program

In XP you do that from SYSTEM > ADVANCED > Environment Variables
Add your path to the Path variable (separated with a semi-colon.)

Barry
A: 

What you are asking should work as this facility is provided by your OS.

Ensure that your path in which your programs are stored is in PATH environment variable and windows does not need .exe in name. So if your $PATH variable has C:/Program in it then typing myprog should make it run.

Open cmd.exe and type path to check which directories are searched for programs. All the directories are places where OS will try to find your program.

Ketan
A: 

Set your path variable to the directory where it exists and you will be all set

Setting windows path variables: http://www.cs.usask.ca/~wew036/latex/env.html

Chris Ballance
+2  A: 
  1. Right-click My Computer
  2. Select Properties
  3. Click the Advanced tab
  4. Click Environment Variables
  5. Select Path from the System variables pane and click Edit
  6. Append the text ";C:\path\to\folder\containing\your\program" (with the semicolon)
Adam Rosenfield
All the responses are good, but yours is the best presented so it worth to be the response.Thanks
Omar Abid
+1  A: 

NOT programming related . . . but see here

From the desktop, right-click My Computer and click properties. In the System Properties window, click on the Advanced tab. In the Advanced section, click the Environment Variables button. Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.

Binary Worrier
+2  A: 

Right click "My Computer" and select properties.

Go to Advanced Tab => Environment Variables.

You will notice there are variables for just your user account and ones for the entire system. Assuming you only want this available on your account....

Edit the PATH variable.... there should already be entries in there for things such as Java.

At the end of the entry, add a semicolon and the path to the directory of the executable you wish to run from the command line, which in this case is c:/program/

next time you open cmd the command will run.

John T
A: 

If you dont want to go screwing with your path statements, you can also put shortcuts to the programs into one of the folders already in the path.

Shortcut keys are also handy... I use Ctrl-Alt-C for calculator, Ctrl-Alt-Q for SQL Management studio, etc. They can be setup for any shortcut (like the ones in your start menu)

StingyJack