D
D
Deiwan2021-09-06 01:21:21
Keyboard
Deiwan, 2021-09-06 01:21:21

How to get key codes through a batch file while typing on the keyboard (not in the console)?

I decided to write a keylogger in a batch file, but I need to intercept keystrokes on the keyboard. I haven't been able to find anything about it on the Internet, but I don't understand what I found. From what I understood, it turns out that there are keyboard codes, and they can be obtained through a batch file using an operator, for example
if % key% = "q" echo q "C:/Users/user/AppData/log.txt ( the syntax is most likely wrong) only instead of key is something else. Am I right, or is there no such thing in bats and will not be?
PS When typing at all on a PC. Even if all windows are closed, and the cat ran over the keyboard, then these presses should also sign up
PPS And yes, I know that the idea is the most debility, please do not write comments on this topic.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Roganov, 2021-09-06
@Deiwan

Will not work. You can't write a keylogger on a batch file. The level of access is not the same. Yes, and there are very few interfaces for cmd to the axis itself.
And in general, why do you need to write a keylogger? Quit this job. Fi!
If you really want to, then you could dodge and write on a powershell. He has access to dotnet, and dotnet has access to the system. From there you can read the state of the keyboard.
Seriously, why would you? I bet 1/100 your problem can be solved by white methods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question