0
password = "12345678"   
strComputer = "."  
strExe = "taskkill /F /IM explorer.exe"  
' Connect to WMI  
set objWMIService = getobject("winmgmts://"_  
& strComputer & "/root/cimv2")




' Obtain the Win32_Process class of object.  
Set objProcess = objWMIService.Get("Win32_Process")  
Set objProgram = objProcess.Methods_( _  
"Create").InParameters.SpawnInstance_  
objProgram.CommandLine = strExe  

'Execute the program now at the command line.  
Set strShell = objWMIService.ExecMethod( _  
"Win32_Process", "Create", objProgram)  
Do  
returnvalue = inputbox("Please enter your password","Password")  
Select case returnvalue  
Case Password  
MsgBox "Acces granted"

strComputer = "."  
strExe = "explorer.exe"  
' Connect to WMI  
set objWMIService = getobject("winmgmts://"_  
& strComputer & "/root/cimv2")  

' Obtain the Win32_Process class of object.  
Set objProcess = objWMIService.Get("Win32_Process")  
Set objProgram = objProcess.Methods_( _  
"Create").InParameters.SpawnInstance_  
objProgram.CommandLine = strExe  

'Execute the program now at the command line.  
Set strShell = objWMIService.ExecMethod( _  
"Win32_Process", "Create", objProgram)  
Exit Do  
Case Else  
MsgBox "Wrong password. Now loging off.",0,"Wrong Password"  
strComputer = "."  
strExe = "shutdown.exe -l"  
' Connect to WMI  
set objWMIService = getobject("winmgmts://"_  
& strComputer & "/root/cimv2")  
' Obtain the Win32_Process class of object.  
Set objProcess = objWMIService.Get("Win32_Process")  
Set objProgram = objProcess.Methods_( _  
"Create").InParameters.SpawnInstance_  
objProgram.CommandLine = strExe  
'Execute the program now at the command line.  
Set strShell = objWMIService.ExecMethod( _  
"Win32_Process", "Create", objProgram)  
WScript.echo "Created: " & strExe & " on " & strComputer  
WSCript.Quit  
End select  
Loop  

我正在使用这个脚本来锁定我的电脑。但是当我解锁它时,你可以看到我在输入什么。有没有办法禁用它(只能看到带有实际密码的cirkels)?我想知道这是因为想恶作剧一些朋友,如果他们看到我正在输入的密码,我的计划就行不通了。

4

1 回答 1

0

AutomatedChaos 对 AutoIt 的看法是正确的,它不是很复杂。

另一种解决方案是使用 HTA(不漂亮)。

<HTML>
 <HEAD>
  <TITLE> TEST </TITLE>
 </HEAD>

<script language = "VBScript">
    Sub Window_OnLoad
        window.resizeTo 300,150
        screenWidth = Document.ParentWindow.Screen.AvailWidth
        screenHeight = Document.ParentWindow.Screen.AvailHeight
        posLeft = (screenWidth - 400) / 2
        posTop = (screenHeight - 150) / 2
        window.moveTo posLeft, posTop
        strComputer = "."  
        strExe = "taskkill /F /IM explorer.exe"  
        ' Connect to WMI  
        set objWMIService = getobject("winmgmts://"_  
        & strComputer & "/root/cimv2")
        ' Obtain the Win32_Process class of object.  
        Set objProcess = objWMIService.Get("Win32_Process")  
        Set objProgram = objProcess.Methods_( _  
        "Create").InParameters.SpawnInstance_  
        objProgram.CommandLine = strExe  

        'Execute the program now at the command line.  
        Set strShell = objWMIService.ExecMethod( _  
        "Win32_Process", "Create", objProgram)  
    End Sub

    Sub TestSub
        password = "12345678"   

        Do  

        Select case PasswordArea.Value 

        Case Password  
        MsgBox "Acces granted"
        window.close
        strComputer = "."  
        strExe = "explorer.exe"  
        ' Connect to WMI  
        set objWMIService = getobject("winmgmts://"_  
        & strComputer & "/root/cimv2")  

        ' Obtain the Win32_Process class of object.  
        Set objProcess = objWMIService.Get("Win32_Process")  
        Set objProgram = objProcess.Methods_( _  
        "Create").InParameters.SpawnInstance_  
        objProgram.CommandLine = strExe  

        'Execute the program now at the command line.  
        Set strShell = objWMIService.ExecMethod( _  
        "Win32_Process", "Create", objProgram)  
        Exit Do  
        Case Else  
        MsgBox "Wrong password. Now loging off.",0,"Wrong Password"
        window.close 
        strComputer = "."  
        strExe = "shutdown.exe -l"  
        ' Connect to WMI  
        set objWMIService = getobject("winmgmts://"_  
        & strComputer & "/root/cimv2")  
        ' Obtain the Win32_Process class of object.  
        Set objProcess = objWMIService.Get("Win32_Process")  
        Set objProgram = objProcess.Methods_( _  
        "Create").InParameters.SpawnInstance_  
        objProgram.CommandLine = strExe  
        'Execute the program now at the command line.  
        Set strShell = objWMIService.ExecMethod( _  
        "Win32_Process", "Create", objProgram)  
        WScript.echo "Created: " & strExe & " on " & strComputer    
        End select  
        Loop
    End Sub
</script>
<HTA:APPLICATION 
     ID="objTest" 
     APPLICATIONNAME="TEST"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
>
    <BODY SCROLL="NO" BGCOLOR="#E0E0E4" TEXT="#000000">
    <TABLE>
        <input type="password" name="PasswordArea" size="30"><P>
        <input id=runbutton  class="button" type="button" value="Submit" name="run_button"  onClick="TestSub">
    </TABLE>
    </BODY>
</HTML>
于 2013-02-08T13:51:04.047 回答