Set Splunk environment variables on Windows

You do not need to set Splunk environment variables to use the CLI on Windows. If you want to use variables to run CLI commands, you must set variables manually.

Set temporary variables on the command prompt

  1. Open a PowerShell window, or a command prompt.
  2. Use a Powershell variable or environment variable to set a quick reference path to Splunk Enterprise.
    PowerShell Command prompt
    $splunk_home="C:\Program Files\Splunk" set SPLUNK_HOME="C:\Program Files\Splunk"
  3. Call the variable when running Splunk Enterprise CLI commands.
    PowerShell Command prompt
    & $splunk_home\bin\splunk status %SPLUNK_HOME%\bin\splunk status

Set permanent environment variables

To set a permanent variable, see Add or change environment variables on MS TechNet.