Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Hi I often use Power Shell on Windows 7

I'm often typing commands like

C:\Python26\ python.exe example.py

C:\Python26\scripts\ pip.exe install examplePy

C:\Python26\scripts\ easy_install.exe examplePy

I would like to simply type (as I do on Linux)

python example.py

easy_install examplePy

pip install examplePy

How do I go on about it?

Help would be very much appreciated.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

You'll need to set the PATH. There are several paths, and in the end they (usually) get merged in to one.

PATH entries are delimited by semicolon (;).

Two are managed by Windows:

  • The system path. Affects all users on the computer.

  • The user path. Affects all programs you run under your user account.

Under Windows 7, the first two are easy to find: open the start menu and type PATH.

alt text

Under older Windows version, you'll need to find the Environment Variables settings. There are several ways to get to them, and it varies by Windows version, but the other answers are valid.

alt text

A third is process-specific:

  • The current process path. Affects the current process and any new processes it creates.

If you're in a PowerShell session, the PATH is visible as $env:PATH. To add something, use +=. I'd recommend using env. vars. instead of hard paths where possible.

PS > $env:PATH += ";C:\Python26\"
PS > $env:PATH += ";$($env:ProgramFiles)\Bar\"

Normally you'd do this in your profile. The path can be found at $profile:

PS > notepad $PROFILE

share|improve this answer
    
Additional tip: Powershell comes with an Integrated Script Editor, which supports Powershell syntax highlighting. It is nicer to edit Powershell profile with it. You can use it like this: PS > powershell_ise $profile –  Mr Alpha Dec 28 '11 at 13:43
add comment

Add folders C:\Python26\ and C:\Python26\scripts to path. Go to system administration -> Environment -> Locate path and add your folders. Do not delete anything.

share|improve this answer
1  
except Quicktime. you can remove Quicktime from your path and your computer will survive. i promise. –  quack quixote Jan 23 '10 at 19:21
add comment

You can set the system variable PATH. Here you can store several directories which will be searched when you enter a command on the command line and this command is not found in the current directory.

Go to system control and search for "path" in the search box.

share|improve this answer
    
Thank you very much Martin. But I noticed I have to set these every time I reboot. :( –  RadiantHex Jan 23 '10 at 19:09
    
@RadientHex - you need to update the PATH in the registry as per @Lukas's answer. Just updating the PATH in the current command window will work, but the changes are local to that window. –  ChrisF Jan 23 '10 at 19:15
    
actually, I meant this, too. I only didn't know the exact english names in the system control, because I'm using German Windows :) –  Martin Jan 24 '10 at 11:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.