<!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <script> getUserName(); getProcess(); getspecialfolder(); getdiskinfo("c"); //runcalc(); readreg() ; getfileinfo("E:\\2.doc"); clientInfo(); function F11Handler() { var WsShell =new ActiveXObject(‘WScript.Shell‘); WsShell.SendKeys("{F11}"); } //取得机器名,登录与和登录用户名 function getUserName() { var net = new ActiveXObject("WScript.Network"); document.write("domain:"+net.UserDomain+"<br/>"); document.write("computerName:"+net.ComputerName+"<br/>"); document.write("userName:"+net.UserName+"<br/>"); } //取得系统目录 function getProcess() { var pnsys=new ActiveXObject("WScript.shell"); pn=pnsys.Environment("PROCESS"); document.write(pn("WINDIR")+"<br/>"); } //返回系统中特殊目录的路径 function getspecialfolder() { var mygetfolder=new ActiveXObject("WScript.shell"); if(mygetfolder.SpecialFolders("Fonts")!=null) { document.write(mygetfolder.SpecialFolders("Fonts")+"<br/>"); } } //取得磁盘信息 传入参数如:getdiskinfo(‘c‘) function getdiskinfo(para) { var fs=new ActiveXObject("scripting.filesystemobject"); d=fs.GetDrive(para); s="卷标:" + d.VolumnName; s+="------" + "剩余空间:" + d.FreeSpace/1024/1024 + "M"; s+="------" + "磁盘序列号:" + d.serialnumber; document.write(s+"<br/>") ; } //启动计算器 function runcalc() { var calc=new ActiveXObject("WScript.shell"); calc.Run("calc"); } //读取注册表中的值 function readreg() { var myreadreg=new ActiveXObject("WScript.shell"); try{ document.write(myreadreg.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\NeroCheck")+"<br/>"); } catch(e) { document.write("读取的值不存在!<br/>"); } } //写注册表 function writereg() { var mywritereg=new ActiveXObject("WScript.shell"); try{ mywritereg.RegWrite("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\MyTest","c:\\mytest.exe"); alert("写入成功!"); } catch(e) { alert("写入路径不正确!"); } } //删除注册表 function delreg() { var mydelreg=new ActiveXObject("WScript.shell"); if(confirm("是否真的删除?")) { try { mydelreg.RegDelete("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\MyTest"); alert("删除成功!"); } catch(e) { alert("删除路径不正确"); } } } //取得文件信息 调用方式如:getfileinfo(‘c:\\test.pdf‘) function getfileinfo(para) { var myfile=new ActiveXObject("scripting.filesystemobject"); var fi=myfile.GetFile(para); document.write("文件类型:"+fi.type+" 文件大小:"+fi.size/1024/1024+"M"+" 最后一次访问时间:"+fi.DateLastAccessed+"<br/>"); } //取得客户端的信息 function clientInfo() { strClientInfo="availHeight= "+window.screen.availHeight+"\n"+ "availWidth= "+window.screen.availWidth+"\n"+ "bufferDepth= "+window.screen.bufferDepth+"\n"+ "colorDepth= "+window.screen.colorDepth+"\n"+ "colorEnable= "+window.navigator.cookieEnabled+"\n"+ "cpuClass= "+window.navigator.cpuClass+"\n"+ "height= "+window.screen.height+"\n"+ "javaEnable= "+window.navigator.javaEnabled()+"\n"+ "platform= "+window.navigator.platform+"\n"+ "systemLanguage= "+window.navigator.systemLanguage+"\n"+ "userLanguage= "+window.navigator.userLanguage+"\n"+ "width= "+window.screen.width; document.write(strClientInfo+"<br/>"); } </script> </body> </html>
时间: 2024-10-16 12:20:17