1

I'm running the following code on the windows login screen, but the password doesn't write, how can I do? or how can I enter a password

import win32api
#running this code in windows login screen
time.sleep(10)
#password
win32api.keybd_event(55, 0, 0, 0) 
win32api.keybd_event(55, 0, 0, 0)
win32api.keybd_event(55, 0, 0, 0)
#password
win32api.keybd_event(13, 0, 0, 0) #enter

1 Answers1

0

First, you should set your program to run as a server, because once you log off the windows, your program will end. Second, KEYEVENTF_KEYUP should be added after each key has been pressed: win32api.keybd_event(55, 0, KEYEVENTF_KEYUP, 0);

However, this method of automatic login is not very cool. You could use the tool--Autologon

Anther way:set the registry, under the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, set as below,

"AutoAdminLogon"="1"            //enable Auto Logon
"DefaultUserName"="User"        //set the User Name
"DefaultDomainName"="Domain"    //set the Domain Name
"DefaultPassword"="Password"    //set the Password
Drake Wu
  • 6,927
  • 1
  • 7
  • 30
  • I'm actually trying to do this, I'm trying to open the computer that is locked with the web service (non-sleep computer) but I'm not typing the password with win32api when the computer is locked and the enter doesn't work. I'm running the code above and locking the windows, the program is running behind, waiting for windows to open with 10 seconds after 777 + enter, i making robot  – Muhammet Sancaktutan Mar 18 '19 at 12:27
  • You'll need a custom windows credential provider to log in for you. https://stackoverflow.com/questions/6975206/unlock-windows-programmatically – Drake Wu Mar 19 '19 at 09:16
  • thank you drake wu , i think i should work more a bit :) – Muhammet Sancaktutan Mar 19 '19 at 11:33