Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some problems with setting my user variable PATH, my PATH contains the following line:

%PATH%;"C:\Program Files\K-Lite Codec Pack\Media Player Classic";C:\Program Files\SSH Communications Security\SSH Secure Shell 

but when I run mpc-hc.exe from the command line I receive "mpc-hc.exe" is not recognized as an internal or external command, am I doing something wrong?

share|improve this question

migrated from Sep 10 '11 at 7:56

This question came from our site for professional and enthusiast programmers.

no, assume that I run "system" function on C – geek Sep 9 '11 at 12:32
You said "when I run mpc-hc.exe from the command line". Make your mind up. Anyway, you don't set environment variables like that from code. From code you use the programmatic interface. – David Heffernan Sep 9 '11 at 12:38
also while set path=%path%;... makes sense , to have a permanent variable for path, with %path% in the value, sounds nonsensical, 'cos in theory it'd be recursive, though in practice it wouldn't be, but either way it doesn't sound like what one would want. – barlop Oct 16 '11 at 5:32
up vote 2 down vote accepted

Using the PATH command, just add your path(s) after %PATH%, without any quotation marks, dividing distinct items with semicolons:

PATH %PATH%;path1;path2

It doesn't matter whether your paths contain spaces or not, they will be added just as you have typed them.

Also it doesn't matter whether you terminate the list with a semicolon or not.

share|improve this answer

Put it in double qutoes and end with ;

%PATH%;"C:\Program Files\K-Lite Codec Pack\Media Player Classic";"C:\Program Files\SSH Communications Security\SSH Secure Shell";

share|improve this answer

You must log in to answer this question.