EzDevInfo.com

environment-variables interview questions

Top environment-variables frequently asked interview questions

List all environment variables from command line?

I'd like to know if it's possible from windows command line to list ALL environment variables.

Something equivalent to powershell gci env: (or ls env: or dir env:).


Source: (StackOverflow)

How do I get and set Environment variables in C#?

How can I get Environnment variables and if something is missing, set the value?


Source: (StackOverflow)

Advertisements

Setting a system environment variable from a Windows batch file?

Is it possible to set a environment variable at the system level from a command prompt in Windows 7 (or even XP for that matter). I am running from an elevated command prompt.

When I use the set command (set name=value), the environment variable seems to be only valid for the session of the command prompt.


Source: (StackOverflow)

Access environment variables from Python

I set an environment variable that I want to access in my Python application. How do I get this value?


Source: (StackOverflow)

Where can I set environment variables that crontab will use?

I have a crontab running every hour. The user running it has environment variabless in the .bash_profile that work when the user runs the job from the terminal, however, obviously these don't get picked up by crontab when it runs.

I've tried setting them in .profile and .bashrc but they still don't seem to get picked up. Does anyone know where I can put environment vars that crontab can pick up?


Source: (StackOverflow)

How to keep Environment Variables when Using SUDO

When I use any command with sudo the Enviroment Variables were not there for example when I set HTTP_PROXY it works fine with wget without sudo but when I type sudo wget it said It cant bypass the proxy setting.


Source: (StackOverflow)

How do I delete (unset) an exported environment variable?

Before installing gnuplot I set the environment variable GNUPLOT_DRIVER_DIR = /home/gnuplot/build/src.

During the installation something went wrong; now I want to remove the GNUPLOT_DRIVER_DIR environment variable.


Source: (StackOverflow)

How to read environment variable in Node.js

Is there a way I can read environment variables in Node.js code?

Like for example Python's os.environ['HOME'].


Source: (StackOverflow)

How to add to the pythonpath in windows 7?

I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my pythonpath so I can call the apps directly.

I have tried adding C:\My_Projects\; to my Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it still doesn't read the coltrane module and generates this error:

Error: No module named coltrane


Source: (StackOverflow)

Where are environment variables stored in registry?

I need to access an environment variable remotely. To do this I think the best way is to read it from registry.

Where are environment variables stored in registry?


Source: (StackOverflow)

Why does an SSH remote command get fewer environment variables then when run manually? [closed]

I have a command that runs fine if I ssh to a machine and run it, but fails when I try to run it using a remote ssh command like :

ssh user@IP <command>

Comparing the output of "env" using both methods resutls in different environments. When I manually login to the machine and run env, I get much more environment variables then when I run :

ssh user@IP "env"

Any idea why ?


Source: (StackOverflow)

Setting environment variables via launchd.conf no longer works in OS X Yosemite/El Capitan?

It looks like the launchd.conf does not load my environment variable anymore. Has anyone else noticed that?

Is there another solution to permanently set environment variables?


Source: (StackOverflow)

How to get the client IP address in PHP?

How can I get the client IP address using PHP?

I want to keep record of the user who logged into my website through his/her IP address.


Source: (StackOverflow)

Recommended way to get hostname in Java

Which of the following is the best and most portable way to get the hostname of the current computer in Java?

Runtime.getRuntime().exec("hostname")

vs

InetAddress.getLocalHost().getHostName()


Source: (StackOverflow)

How to add a default include path for gcc in linux?

I'd like gcc to include files from $HOME/include in addition to the usual include directories, but there doesn't seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include directory at command line when compiling (or in the makefile), but I'd really like a universal approach here, as in the library case.


Source: (StackOverflow)