# How useful is $EvaluationEnvironment? Bug introduced in 10.0 and persisting through 11.3 A support case with the identification [CASE:3618534] was created. [...] I filed a report with our development team raising the issues [...] $EvaluationEnvironment was supposed to be a panacea for: Good way to discriminate between Mathematica/PlayerPro/CDFPlayer

But from my experience it is not full working in a "desktop" area.

The remaining question is: I don't have time to check everything, could you? :)

### Working:

• "WebEvaluation"

• "WebAPI"

• "WebForm"

• "Subkernel" (fixed somewhere around 11.2)

### I'm not sure

• "Session" - it works well but all others that fail return "Session" so tough to count on it

• "WebLoad" not clear in comparison to "WebAPI"

• "RemoteSession", "WebServer", "CloudCDF", "PlugInCDF", "WSTP" - not tested

### Not working:

• "CDF"

• "Script"

• "Scheduled"

The bug is confirmed and a workaround is available in the linked topic.

Nothing to do here now so I will move the code part of the question to this wiki answer to remove it from an unanswered stack and make a terse list on top.

### Code samples to reproduce specific values of $EvaluationEnvironment: • "WebEvaluation" CloudEvaluate[$EvaluationEnvironment]

• "WebAPI"

CloudDeploy[
APIFunction[{"x" -> String}, $EvaluationEnvironment &] ] // URLExecute[#, {"x" -> "100"}, "JSON"] &  • "WebForm" CloudDeploy[FormFunction[{"x" -> String},$EvaluationEnvironment &]]

• "Subkernel"

ParallelEvaluate[{$KernelID,$EvaluationEnvironment}, Kernels[]]


• "WebLoad"

CloudDeploy@Delayed@{$EvaluationEnvironment, DateList[]}  • "CDF"  SystemOpen @ CDFDeploy[ "test.cdf" , Dynamic[{RandomReal[],$EvaluationEnvironment}, UpdateInterval -> 1]
]

• "Script"

path = FileNameJoin[{$HomeDirectory, "Desktop", "test.wl"}]; Export[path, "Print @$EvaluationEnvironment", "Text"];

Import["! math.exe -script " <> path , "Text"]

• "Scheduled"

 RunScheduledTask[Print@\$EvaluationEnvironment, {2}]