1.

Solve : when any key is pressed?

Answer»

I need a powershell script which will detect for about 3 MINUTES if any key on keyboard is pressed. When it is it MAKE a txt file.
O have this script but it doesn't work I tested it on windows 7 and windows 10
Any idea about it?
Code: [Select]1..100000 | ForEach-Object {
"I am at $_"
if ($Host.UI.RawUI.KeyAvailable)
{
New-Item E:\key.txt -ItemType "file" -Force
BREAK
}

Start-Sleep -SECONDS 0.3
}On the PC and most other devices, a low level code handles the keyboard.
You need to re think your idea. Programs to manage a keyboard are very special.



Discussion

No Comment Found