Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript login script quest!

Status
Not open for further replies.

Udir

Technical User
Aug 16, 2001
111
US
I am using javascript for my AD login scripts.

I can get the value of "windir" out of the environment of
%systemroot% but need to actually resolve it to either
C:\windows or C:\winnt

Is it possible to assign what would be the value of %systemroot% to a variable to use?
 
Hello Udir,

You can get it like this.
[tt]
var WshShell=new ActiveXObject("WScript.Shell");
var sysroot=WshShell.ExpandEnvironmentStrings("%systemroot%");
[/tt]
Note also that %systemroot% is defined for winnt-series only. Sometimes %windir% should be used.

regards - tsuji
 
tsuji,

i tried
<script language="javascript" type="text/javascript">
function getUser()
{
var WshShell = new ActiveXObject("WScript.Shell");
var sysroot = WshShell.ExpandEnvironmentString("%systemroot%");
alert("wshshell is "+ WshShell + "and sysroot is " + sysroot);
}
</script>

and called with a button but it doesn't work...
any help?
 
That worked great! Thanks! All my systems are winnt based, so it shouldn't be a problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top