environment-variables

Setting environment variables in OS X?

What is the proper way to modify environment variables like PATH in OS X? I've looked on google a little bit and found 3 different files to edit: /etc/paths ~/.profile ~/.tcshrc I don't even have some of these, and I'm pretty sure that .tcshrc is wrong, since osx uses bash now. Anybody have any idea where these variables, especially...

How to keep from duplicating path variable in csh

It is typical to have something like this in your cshrc file for setting the path: set path = ( . $otherpath $path ) but, the path gets duplicated when you source your cshrc file multiple times, how do you prevent the duplication? EDIT: This is one unclean way of doing it: set localpaths = ( . $otherpaths ) echo ${path} | egrep -i "$...

Is there a command to refresh environment variables from the command prompt in Windows?

If I modify or add an environment variable I have to restart the command prompt (minor inconvenience). Is there a command I could execute that would do this without restarting CMD? ...

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

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

Persisting an environment variable through ruby

I am trying to set my dos environment variable in ruby which persists after the script exits. For example if I want a ruby script set_abc_env.rb to set environment variable ABC to blah, I expect to have the following: C:> echo %ABC% C:> set_abc_env.rb C:> echo %ABC% blah How do I do this? ...

Secure access to files in a directory identified by an environment variable?

Can anyone point to some code that deals with the security of files access via a path specified (in part) by an environment variable, specifically for Unix and its variants, but Windows solutions are also of interest? This is a big long question - I'm not sure how well it fits the SO paradigm. Consider this scenario: Background: Sof...

Using system environment variables in log4j xml configuration

Is it possible to reference system environment variables (as opposed to Java system properties) in a log4j xml configuration file? I'd like to be able to do something like: <level value="${env.LOG_LEVEL}" /> and have it get that from the system environment variables, so I can avoid having to pass in so many things with -D parameters....

VC6 setting additional include path using env vars?

I can't believe I am asking this... It has been a while since I used VC6. I set up what I thought was the correct way to include additional directories for include files (I removed another developer's hard coded paths) and put in something like: %MY_DIR%\include but this does not work. Am I missing something? Did VC6 not allow this...

Read environment variables from file in Windows Batch (cmd.exe)

I'm trying to read variables from a batch file for later use in the batch script, which is a Java launcher. I'd ideally like to have the same format for the settings file on all platforms (Unix, Windows), and also be a valid Java Properties file. That is, it should look like this: setting1=Value1 setting2=Value2 ... Is it possible to ...

Environment Variables in Python on Linux

Python's access to environment variables does not accurately reflect the operating system's view of the processes environment. os.getenv and os.environ do not function as expected in particular cases. Is there a way to properly get the running process' environment? To demonstrate what I mean, take the two roughly equivalent programs...

How to set the PYTHONPATH in emacs

Emacs does not recognize my correct python path. I think it is a general problem with emacs not recognizing my environment variables. I have GNU Emacs 22.1.1 (i386-apple-darwin8.9.1, Carbon Version 1.6.0) of 2007-06-17 installed. I have set the PYTHONPATH in my ~/.bashrc. Maybe I should set it somewhere else? ...

Terminal Services: Get Client Name While Running As Administrator

Under normal circumstances, a VB.NET application of mine can check the ClientName environmental variable to get the name of the workstation the user is connecting from. So when WorkstationX RDPs into ServerA: ComputerName=ServerA ClientName=WorkstationX That works fine. If I right-click on the application and choose Run As Administ...

How can I determine the OS of the system from within a Lua script?

Ok I need to determine the system's OS from a Lua script, but Lua as such has no API for this, so I use os.getenv() and query enviromental variables. On Windows checking the enviromental variable "OS" gives me the name of the system's OS, but is there some variable that exists on both Windows and most flavors of Unix that can be checked?...

Remove quotes from named environement variables in Windows scripts

I want to store a URL prefix in an Windows environment variable. The ampersands in the query string makes this troublesome though. For example: I have a URL prefix of "http://example.com?foo=1&amp;bar=", and want to create a full URL by providing a value for the bar param. I then want to launch that url using the "start" command. Addin...

Python - Setting / Getting Environment Variables and Addrs

I need to set an environment variable in Python and find the address in memory where it is located. Since it's on Linux, I don't mind about using libraries that only work consistently on Linux (if that's the only way). How would you do this? Edit: The scope of the problem is as follows: I'm trying to hack a program for class, and essent...

Environment variables in powershell with a dot(.) in the name

I know I can access environment variables in powershell using $Env. For example, I can access FOO with $Env:FOO What I can't figure out is how to access the environment variable called FOO.BAR $Env:FOO.BAR doesn't work. How can I access this from within Powershell? ...

Python 2.5.2 and Solaris 8 (gcc 3.4.2) build issues

Hello there, I'm trying to build python 2.5.2 on Solaris 8 using gcc 3.4.2. I can't see any immediate errors in the ./configure step but, once built and i enter the python shell doing an import time errors with : Python 2.5.2 (r252:60911, Nov 21 2008, 18:45:42) [GCC 3.4.2] on sunos5 Type "help", "copyright", "credits" or "license" for...

How do I set environment variables from Java?

How do I set environment variables from Java? I see that I can do this for subprocesses using ProcessBuilder. I have several subprocesses to start, though, so I'd rather modify the current process's environment and let the subprocesses inherit it. There's a System.getenv(String) for getting a single environment variable. I can also g...

Windows Command Line: Non Evaluation of Environment Variable

I would like to provide the raw text referring to an environment variable to a command instead of evaluating the environment variable. I need this to configure BizTalk from the command line, for example: BTSTask.exe AddResource -ApplicationName:App1 -Type:System.BizTalk:BizTalkAssembly -Overwrite -Source:..\Schemas\bin\development\Ap...

Evaluate environment variables into a string

I have a string representing a path. Because this application is used on Windows, OSX and Linux, we've defined environment variables to properly map volumes from the different file systems. The result is: "$C/test/testing" What I want to do is evaluate the environment variables in the string so that they're replaced by their respect...