Hi,
i have written a code for getting the environmental variable.I am getting the error as wscript undefined.

<html>
<head>
<title>Test</title>
<script language="javascript">
function getEnvironment() {
	var shell = WScript.CreateObject("WScript.Shell");
 	var env = shell.Environment("USER"); 
	alert(env("temp"));
}
</script>
</head>
<body>
<button onclick="javascript:getEnvironment();">Click</button>
</body>
</html>

What browser and system are you on?

Please note that this will not work on many OSes (mainly Unix-based such as Mac and Linux). I think the only supporting browser is Internet Explorer for Windows, since WScript can only be accessed through ActiveX. The only possible reason you might want to use this is if you're not developing for the web.

Anyways, here is your answer.

What browser and system are you on?

mozillafirefox browser and OS xp

Thanks for the info, I appreciate it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.