HTA script to display computer name

 

Code:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <HTA:APPLICATION ID="A1" ICON="" APPLICATIONNAME="Test-HTA" sysMenu="no" navigable="yes" scroll="no" border="none" showintaskbar="yes" singleinstance="yes" innerborder="no">
<title>Test-HTA</title>
</head>

<body>
<script type="text/javascript">
    function computername()
    {
        var wshShell = new ActiveXObject("WScript.Shell")
        var sComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
        return sComputerName
    }
</script>

<strong>Computer Name is: <script type="text/javascript"> document.write(computername());</script></strong>

</body>
</html>

 

 

Output:

image

0 thoughts on “HTA script to display computer name

Leave a Reply

Your email address will not be published. Required fields are marked *