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?
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
}