Environment Variables

Other topics

Remarks:

Let get user profile path in a dynamic way for scripting under windows

Sample to get user profile path

# will retrieve my home path
ENV['HOME'] # => "/Users/username"

# will try retrieve the 'FOO' environment variable. If failed, will get 'bar'
ENV.fetch('FOO', 'bar')

Syntax:

  • ENV[variable_name]
  • ENV.fetch(variable_name, default_value)

Contributors

Topic Id: 4276

Example Ids: 14966

This site is not affiliated with any of the contributors.