Below are instructions I am following for setting environment variables:

Next you'll need to set a couple of environmental variables. You can do this at the command line or you can set it up in your computer's/master node's bash_rc/bash_profile files.

export SPARK_HOME="$HOME/Downloads/spark-1.3.1"

I open cmd.exe and type in the command above and I get 'export' is not a recognized command. How do I use cmd.exe to set SPARK_HOME? The site I am using to install pyspark is: https://plot.ly/ipython-notebooks/apache-spark/


Setting up an environment variable through CMD:

Open CMD

Set Spark_Home="$HOME/Downloads/spark-1.3.1"

Now test by just entering %Spark_Home% in CMD and hit enter.

  • 1
    You need to use setx to set the value permanently. set applies only to the current cmd shell. – DavidPostill Jan 11 '16 at 12:44

For setting an environment variable for the current user (windows account):

  1. close your current cmd shell/terminal;
  2. access Run (press Win + R);
  3. type setx HOME %userprofile% (for example);
  4. press Enter.

Voilá, you can now reopen the cmd shell and type set HO to check all variables starting with HO.

Alternatively, if you prefer to access the window to check all of them, run:

  • %windir%\system32\rundll32.exe sysdm.cpl EditEnvironmentVariables

Note: in OP's specific case, the command for setting would be:

  • setx SPARK_HOME "%userprofile%\Downloads\spark-1.3.1"

For more information, type in cmd shell setx /?.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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