Adds a set of Windows variables to a set of properties.

@return the environment properties

@throws EnvironmentException if an error occurs
480548
private static Properties getWindowsShellVariables()
        throws EnvironmentException
    {
        Properties properties = new Properties();
        // build the command based on the shell used: cmd.exe or command.com
        StringBuffer buffer = new StringBuffer( getWindowsUserShell() );
        buffer.append( " /C SET" );
        String cmdExec = buffer.toString();

        int exitValue = readEnvironment( cmdExec, properties );
        if( 0 != exitValue )
        {
            String message = "Environment process failed with non-zero exit code of " + exitValue;
            throw new EnvironmentException( message );
        }

        return properties;
    }
123087
public UpdateAppRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
        setEnvironmentVariables(environmentVariables);
        return this;
    }
1346481
public FunctionConfigurationEnvironment withVariables(java.util.Map<String, String> variables) {
        setVariables(variables);
        return this;
    }
35675
public Properties toAllProperties() {
    Properties allProp = new Properties();
    // import local properties
    allProp.putAll(toProperties());

    // import parent properties
    if (_parent != null) {
      allProp.putAll(_parent.toProperties());
    }

    return allProp;
  }
896522
public Properties getConfig() {
    try {
      Properties properties = new Properties();
      if (null != resources.getGlobal()) populateConfigItems(properties, resources.getGlobal());

      if (null != resources.getLocals()) {
        for (URL url : resources.getLocals()) {
          populateConfigItems(properties, url);
        }
      }

      if (null != resources.getUser()) populateConfigItems(properties, resources.getUser());
      return properties;
    } catch (Exception e) {
      logger.error("Exception", e);
      throw new RuntimeException(e);
    }
  }
828470
public Properties toProperties()
	{
		Properties p = new Properties();

		for (NameValuePair nvp : vars.values())
		{
			p.put(nvp.name, nvp.value);
		}

		return p;
	}
1074509
public void collectVariables(EnvVars env, Run build, TaskListener listener) {
        EnvVars buildParameters = Utils.extractBuildParameters(build, listener);
        if (buildParameters != null) {
            env.putAll(buildParameters);
        }
        addAllWithFilter(envVars, env, filter.getPatternFilter());
        Map<String, String> sysEnv = new HashMap<>();
        Properties systemProperties = System.getProperties();
        Enumeration<?> enumeration = systemProperties.propertyNames();
        while (enumeration.hasMoreElements()) {
            String propertyKey = (String) enumeration.nextElement();
            sysEnv.put(propertyKey, systemProperties.getProperty(propertyKey));
        }
        addAllWithFilter(sysVars, sysEnv, filter.getPatternFilter());
    }
186436
public static void addEnvVarsFromContextForExec(final ExecTask execTask,
                                                    final Map<String, Map<String, String>> dataContext) {
        final Map<String, String> environment = generateEnvVarsFromContext(dataContext);

        if (null != environment) {
            for (final Map.Entry<String, String> entry : environment.entrySet()) {
                final String key = entry.getKey();
                if (null != key && null != entry.getValue()) {
                    final Environment.Variable env = new Environment.Variable();
                    env.setKey(key);
                    env.setValue(entry.getValue());
                    execTask.addEnv(env);
                }
            }
        }
    }
1228008
public void addEnv(final Environment.Variable var) {
    this.compilerDef.addEnv(var);
    for (int i = 0; i < this._compilers.size(); i++) {
      final CompilerDef currentCompilerDef = this._compilers.elementAt(i);
      currentCompilerDef.addEnv(var);
    }
    this.linkerDef.addEnv(var);
  }
1039299
public void addEnv(final Environment.Variable env){
        if(null==envVars) {
            envVars = new ArrayList<Environment.Variable>();
        }
        envVars.add(env);
    }
1260695
public java.util.Map<java.lang.String, java.lang.String> getEnvVariablesMap() {
    return internalGetEnvVariables().getMap();
  }
279070
public Launcher addEnvironmentVariable(final String key, final String value) {
        env.put(key, value);
        return this;
    }
93746
@Nullable
	public Properties getProperties(EnvVars envVars,
									VariableResolver<String> varResolver) {
		return createProperties(envVars, varResolver);
	}
825553
public JmxServerBuilder environmentProperties(Properties environmentProperties) {
        HashMap<String, Object> properties = new HashMap<>(environmentProperties.size());
        for (Map.Entry<Object, Object> entry : environmentProperties.entrySet()) {
            properties.put(entry.getKey().toString(), entry.getValue());
        }

        endpoint.getEndpointConfiguration().setEnvironmentProperties(properties);
        return this;
    }
216165
private static EnvVars inherit(@Nonnull Map<String,String> overrides) {
        EnvVars m = new EnvVars(EnvVars.masterEnvVars);
        m.overrideExpandingAll(overrides);
        return m;
    }
50061
public VarValueDef addProperties( Collection<String> properties)
    {
    if( properties != null)
      {
      assertPropertyIdentifiers( properties);
      properties_.addAll( properties);
      }

    return this;
    }
1332813
@Override
	public String getEnvironment() {
		File file = new File(getFileName());
		Properties properties = new Properties();
		if (file.exists() && file.canRead()){
			BufferedInputStream inStream = null;
			try{
				inStream = new BufferedInputStream(new FileInputStream(file));
				properties.load(inStream);
			}catch(IOException ioe){
				log.info("Failed to load properties: "+getFileName(), ioe);
			}finally{
				if (inStream != null){
					try {
						inStream.close();
					} catch (IOException e) {
						log.info("Failed to load properties: "+getFileName(), e);
					}
				}
			}
		}
		String property = properties.getProperty(getPropertiesKey());
		return property;
	}