MozillaZine

How to set an environment variable only for Thunderbird?

User Help for Mozilla Thunderbird
pstover
 
Posts: 275
Joined: July 29th, 2005, 3:25 am

Post Posted January 11th, 2018, 10:56 am

Assume I want to set an environment variable just for Thunderbird.

It should not be visible outside for other programs.

How can I achieve this?

Peter

morat
 
Posts: 2823
Joined: February 3rd, 2009, 6:29 pm

Post Posted January 11th, 2018, 11:57 am

Try something like:

* Command Prompt

Code: Select all
set Example=Alpha Beta Gamma
thunderbird.exe

* Thunderbird

Code: Select all
// scriptable access to current process environment
var environment = Components.classes["@mozilla.org/process/environment;1"].
  getService(Components.interfaces.nsIEnvironment);
alert(environment.get("Example")); // Alpha Beta Gamma

Set Command
http://ss64.com/nt/set.html

nsIEnvironment Interface
http://developer.mozilla.org/en-US/docs ... nvironment

Edit:

If I then open the firefox.exe process with windows explorer or in another command prompt window, then the "Example" environment variable would be an empty string.
Last edited by morat on January 11th, 2018, 3:06 pm, edited 1 time in total.

pstover
 
Posts: 275
Joined: July 29th, 2005, 3:25 am

Post Posted January 11th, 2018, 12:58 pm

This is exactly what is NOT suitable

As I said in my initial posting: The environment variable should NOT be visible by other prigrams.
If I enter

set Example=Alpha Beta Gamma

It IS visibale by other programs since it is global
So your suggestion does NOT fit.

So I need a file in "profile" folder where to enter the environment variables.

Peter

Return to Thunderbird Support


Who is online

Users browsing this forum: No registered users and 4 guests