environment-variables

set vcbuild environment through msbuild

I have an msbuild project file that is used for building several C++ projects (*.vcproj). Here's a part of a typical project file, in which global environment variables for the build are overridden as properties: <PropertyGroup> <MYBINDIR>d:\buildsysroot\bin</MYBINDIR> <MYLIBDIR>d:\buildsysroot\lib</MYLIBDIR> ... </PrpertyGroup> ...

How do I get the current user's desktop folder location *after* they have moved it?

I'm hoping there's a way to play with environment variables to achieve this because I need to access this in a Windows command shell. I found the directory in [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders] Desktop, but I have no idea how to access this information from a command shell! %UserPr...

Append date and time to an environment variable in linux makefile

Hi In my makefile I want to create an environment variable using the current date and time. Psuedo code: LOG_FILE := $LOG_PATH + $SYSTEM_DATE + $SYSTEM_TIME Any help appreciated - thanks. ...

Bash environment variables and finding installation directories

I have a Bash script that basically initializes an application and sets parameters. One of these parameters is the location to OpenOffice. Now OpenOffice doesn't set an environment variable when you install it. What is the best method of finding the location of an application installed and caching that information so you don't have to d...

How to get program files environment setting from VBScript

In a batch file you can use %PROGRAMFILES% to get the location of the program files directory, how do you do it in a VBScript? ...

How do I print the list of registry keys in HKCU\Environment to SDTOUT using JScript (WSH)?

I want to iterate over the environment keys and print a list of these items. ...

How can I determine if a script was called from the command line or as a cgi script?

I have a script that I wrote that can either be used on the command line or as a CGI script, and need to determine how the script was called so I can output a content-type header for web requests (and maybe some anti-cache headers too). My first thought is to check for the existance of http environment variables: my $js = build_javascri...

How do I force RAILS_ENV=development from within environment.rb or initializers?

Hi there, Our host does not allow us to modify the passenger config file (i.e. the apache config OR the vhosts file), but we'd like to run rails in dev mode. So we have to specify the environment (prod/dev/test) in one of the files that rails loads AS the application is restarted. Anyone know how to do this? We've tried the following wi...

Access environmental parameters in web.xml from Web Service application

I have to build two web service applications to be deployed to different servers (WebSphere 6.1). One of them is “linked” to another by calling its services, so the first web service application should be aware of the endpoint URL of the second one. Those applications are working in different environments: Dev, Test and Production. I h...

Programmatically adding a directory to Windows PATH environment variable

I'm writing a Win32 DLL with a function that adds a directory to the Windows PATH environment variable (to be used in an installer). Looking at the environment variables in Regedit or the Control Panel after the DLL has run shows me that my DLL has succeeded in adding the path to *HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Sess...

Environment variable to control java.io.tmpdir?

I've used the TMP environment variable to control things like where gcc writes it's temporary files, but I can't seem to find an equivalent for java's createTempFile API. Does such an environment variable exist? ...

Building an Evironment Variable with SET using a FOR loop in Command Prompt

Hi, I am having trouble with the following command prompt commands (in Windows XP). set SOMEVAR= for /F %i in (1 2 3) do set SOMEVAR=%SOMEVAR% "%i" echo %SOMEVAR% I expect it to build the SOMEVAR variable so that it contains each item in the for loop in quotes, separated by a space:  1 2 3 However what this is what I get...

Read environment variables from logback configuration file

Hi, I have this logback.xml file: <configuration debug="true" scan="true" scanPeriod="60 seconds"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> </layout> </appender...

Can one use environment variables in Inno Setup scripts?

I need to find a way to reference environment variables INSIDE the Inno Setup script file (.iss)... I've found plenty of references to MODIFYING the environment from an .iss, but none on how to actually use it. Is this possible? ...

Optional environment variables with vcproj/vsprops

Is there any way to make an environment variable substituion in a project file (with or without vsprops) that, if the variable is not found, is substituted instead with a default value? I haven't found any way to do this, because everything seems to override environment variables. EDIT: I need this to work for a property, not for an env...

Export a variable from PHP to shell

I'm trying to set a variable that should be accessible from outside PHP. Ideally this should be a local variable, but environment variables are also welcome. First, I've tried putenv(), but this gives no result: $ php -r "putenv('PHP_TEST=string');" ; echo $PHP_TEST $ When i call getenv() from the same script — it results in ...

Checking if a file exists on a 64 bit Vista machine with a 32 bit program

So, I have a 32 bit program which needs to check if files exist. However, the locations (which can come from both shortcuts and the registry) often make use of Environment Strings. I use the ExpandEnvironmentStrings api to expand them, then check if the file exists. However, because it is a 32-bit application (note environmental strin...

Windows Registry Variables vs. Environment Variables?

At first glance this seems like a purely subjective/aesthetic issue, but I'd be interested to hear opinions (especially any technical ones) on whether environment variables or the registry is the preferred place for storing configuration data in a Windows environment. I can currently only think of the following differences: Registry s...

Shell variable expansion - indirection problem while calling a utility with env

Hi all, sorry if this is a repeated question but I was trying to figure out env, ( i.e. calling a util with a new environment). Just as an example my environment variable KDEDIRS = /usr in my current environment and lets say I type: env -i KDEDIRS=/home/newkdedir env This outputs KDEDIRS=/home/newkdedir as expected. (i.e calling se...

How do I get the "ERRORLEVEL" variable set by a command line scanner in my C# program?

In my website I want to virus-check any uploaded files before saving them into my database. So I save the file to the local directory then kick-off a command-line scanner process from inside my C# program. Here is the code I use: string pathToScannerProgram = Path.Combine(virusCheckFolder, "scan.exe"); ProcessStartInfo startInfo = n...