0

So I set my environment variables and their value correctly.

When I open cmd and enter the variable's name i get an error saying:

(variable name here) is not recognized as an internal or external command, operable program or batch file.

So far I ran the SET command that prints out all the environmental variables and I could see the variables I am trying to submit do exist!.

In addition, when I tried and entered %variable name% the variable did work.

How can i set the environmental variables so simply entering their names on the command prompt will be enough to run their value?

randominstanceOfLivingThing
  • 16,873
  • 13
  • 49
  • 72
  • what does it have to do with python, and pip? – wroniasty Aug 12 '16 at 15:44
  • 2
    You don't. Command lines are not matched against environment variables, variables are only used for string interpolation. Perhaps instead of setting an environment variable you want to create a batch file (*.cmd for the modern command processor)? Or create an alias using the `doskey` tool. – Ben Voigt Aug 12 '16 at 15:50
  • 2
    Mostly duplicate of http://stackoverflow.com/q/20530996/103167 – Ben Voigt Aug 12 '16 at 15:50

2 Answers2

1

You are getting confused between environment variables and programs. Environment variables are not programs. Also environment variable are used by programs to identify the values that the programs needs to work on. The command interpreter uses the PATH and PATHEXT environment variables to lookup programs and file extensions. The error you are getting is when the command that you are entering is not found by the command interpreter based on your PATH setting.

I think you are getting confused between using a REPL vs command prompt.

randominstanceOfLivingThing
  • 16,873
  • 13
  • 49
  • 72
1

Answered already in your question:

… when I tried and entered %variable name% the variable did work.

==> set "variable name=ver"

==> %variable name%

Microsoft Windows [Version 6.3.9600]

Another example:

==> set "variable2=C:\Program Files\Foo App Folder\whois.exe"

==> %variable2%
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

==> "%variable2%"

Whois v1.12 - Domain information lookup utility
Sysinternals - www.sysinternals.com
Copyright (C) 2005-2014 Mark Russinovich

Usage: whois [-v] domainname [whois.server]
 -v   Print whois information for referrals
JosefZ
  • 28,460
  • 5
  • 44
  • 83