Hello!
How to display in JavaScript code any Windows environment variable?
How to display in JavaScript code any Windows environment variable?
I think it is possible using Internet Explorer ActiveX and the oShell.Run () command. Can not have .bat on the client side.
Thank you.
Windows environment variable
Moderator: DosItHelp
Re: Windows environment variable
You know that this is a Windows Batch forum?
Nevermind.
*.js
This will work as stand alone script. I don't expect that anything like that will work in a browser since every browser does some kind of sandboxing and strictly restricts the access of websites to the client machine (fortunately!).
Steffen
Nevermind.
*.js
Code: Select all
var objWSHShell = new ActiveXObject('WScript.Shell'),
objProcEnv = objWSHShell.Environment('PROCESS');
for(var enumProcVars = new Enumerator(objProcEnv); !enumProcVars.atEnd(); enumProcVars.moveNext())
{
var arrPair = enumProcVars.item().split('='),
strName = arrPair[0],
strValue = objWSHShell.ExpandEnvironmentStrings(arrPair[1]);
WScript.Echo(strName + '=' + strValue);
}
Steffen