environment-variables

'javac' is not recognized

I have added Path variable 'C:\Program Files\Java\jdk1.6.0_21\bin' in Environment Variables, but it still gives me this error: 'javac' is not recognized as an internal or external command, operable program or batch file when I try to run javac mycode.java. I am going insane, please help. Thanks. ...

QtXmld4.dll was not found

Hi all, I have Qt 4.6.3 installed at C:\Qt\4.6.3 (Windows). I just compiled a Qt application and went to run the EXE. When double-clicking on the executable, saw an error message: "This application has failed to start because QtXmld4.dll was not found. Re-installing the application may fix this problem." Found QtXmld4.dll in C:\Qt\...

Determine current environment variables

App: C#, .NET4, Windows 7 When an app starts up, it gets a copy of the current environment variables and they stay constant for the life of that app. I want to know how to get the actual current environment variables, allowing me to react to changes. Do I need to go to the registry? I've pondered spawning a cmd.exe and dumping the ou...

How to omit file path compression?

I have a process that injects environment variables while the process is running and all that works fine. However, when I expand one of the environment variables (Environment.ExpandEnvironmentVariables in C#) sometimes I get a compressed value of the file path: d:\progra~1\mifbef~1... instead of d:\Program Files\... Functionally ...

How can I list all environmental variables defined for GUI applications on OS X?

How can I see what environmental variables are set for GUI applications on OS X? On OS X the GUI applications are not able to access the environmental variables used by console apps and you have to edit them in ~/.MacOSX/environment.plist by using the Property Editor. How can I display them? I tried to run a python script from the Fin...

How to reference a environment variable inside Obj-C code

I define a path variable in Xcode source tree called "MY_SRC_DIR". I would like to get the value of this environment variable and put it in a NSString in the obj-c code. For example, -(NSString*) getSourceDir { return @"${MY_SRC_DIR}"; // not the right solution and this is the question } ...

Replacing tilde with $HOME in simple shell

Hello. I am writing a simple Unix shell in C. Here's what I have so far. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int main() { char x[256], y[256], z[256]; while (1) { getcwd(y, sizeof(y)); printf("%s$ ", y); fgets(x, sizeof(x), stdin); if (x[0] == 'c' && x[1...

In vbscript, how do I run a batch file or command, with the environment of the current cmd prompt window?

In vbscript, how do I run a batch file or command, in the current cmd prompt window, without starting a new process. For example. According to script56.chm (the vbscript help apparently) Windows Script Host Run Method (Windows Script Host) "Runs a program in a new process" So if I have code that uses that e.g. a VBS file, and a BAT...

Latex Dollar Sign \\ How do I signify Linux Environment Variables in latex?

Hi. I am aware to output dollar signs you escape it with \ such that: \$ % prints '$' However, I can't print something like \$ JAVA_HOME % prints '$ JAVA_HOME' The space in between the $ and JAVA_HOME is what's annoying. How can I make it so it's one word? ...

Why is my $_ENV empty?

I'm running Apache/2.2.11 (Win32) PHP/5.3.0 and I did the following in my .htaccess file: SetEnv FOO bar If I print out the $_ENV variable in a PHP file, I get an empty array. Why doesn't my environment variable appear there? Why is it empty in the first place? I did find my variable though, but it appears in the $_SERVER variable. A...

need linux equivalent to windows "echo %date% %time% %COMPUTERNAME%"

In Linux, "echo %date% %time% %COMPUTERNAME%" returns %date% %time% %COMPUTERNAME% not Fri 09/24/2010 10:46:25.42 WXP2010043001 as Windows does. I need to be able to do this for the logs I'm setting up. ...

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. set name=value seems to be only valid for the session of the command prompt.. ...

Setting a Environment Variable without restarting in Windows

I am running a Windows 7 system where i want to be able to set a system environment variable and be able to see it in subsequent command prompts that i launch. When i set the system environment variable using "setx" thins work fine, But given that i want to use the same script code for XP and Windows 7 I cannot do this on XP because XP ...

Is there a better way to achieve this using Perl?

I am writing a Perl script which does this : Reads the values of the environment variables a to z in a loop. Depending on the value of the environment variables, generates a result file similar to a - 1,2,3,4 b - a,b,c c - $234.34,$123.12 keyword1 %a% keyword2 %b% keyword3 %c% The point to note is that all the declarations have to c...

How do I access environment variables correctly in Perl?

$ cat flaglist.log flag1 flag2 flag3 flag4 $ Perl code my $infile = "flaglist.log"; open my $fpi, '<', $infile or die "$!"; while (<$fpi>) { chomp; if ($ENV{$_}) { # something wrong here func($_); } else { print "oops\n"; } } $ perl code.pl oops oops oops oops $ All the four f...

How to search the correct directory for imports

I am trying to test some code. The main script requires imports from a number of subdirectories. The structure of the scripts is like this (I edited it to make it clear that dir1 and 2 are subdirectories of build): build ascript.py dir1 script2.py dir2 script3.py subdir1 script4.py script5.py subdir2 ...

Can a script.bat make changes to Windows PATH Environment Variable

I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so can a .bat script help me with something like that? I actually need to download a zip from a lo...

How do I set an Win32 system environment variable in Perl?

I want to be able to set a system environment variable in Perl and I wrote the following script (inspired from this idea) to accomplish this: use Win32; use Win32::API; use Win32::OLE qw( in ); my $machine = "."; my $WMIServices = Win32::OLE->GetObject ( "winmgmts:{impersonationLevel=impersonate,(security)}//$machine/root/cimv2" ) || d...

Referencing $HOME or ~ in Info.plist

I need to set an environment variable for my application when it is started from the Finder. It is the location of a directory. The path is relative to $HOME. I am using the Info.plist file to set this environment variable. However, I cannot get it to take $HOME or ~. Can this be done? i.e. I want something like this: MYAPPDIR=~/myappn...

Where should I store calculated values I use throughout my application in Rails?

I have the following variable definition: @monday = (Time.now).at_beginning_of_week I use that in different models, controllers, and views. Where can I define it (and how should I define it -- @@? ) so I can define it once and use throughout my Rails application? Should it be in environment.rb? Should it be a @@? ...