Group press

I am making a text game in Batch, and I was wondering if you can complete the task if the player presses the up arrow? I looked at the help files and searched on Google, but without any solutions. I cannot install any additional software because I am using a Windows RT device. Also, if this cannot be done in a package, can it be done in VBS or Powershell?

+4
source share
3 answers

This can be done using powershell, it can also detect arrow keys.

powershell "$key = [Console]::ReadKey($true);Write-Host $key.key;"

And it can even detect control keys

powershell "$key = $host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); Write-Host "key= $key.VirtualKeyCode";"
+4
source

Powershell , . SO. , .

+1

You can simply use:

choice /c wsad /n /m "Press a key."

And: if %errorlevel%==1for detection wand %errorlevel%==2for detection s, etc.

This is an easy way to detect keystrokes. You cannot use only one batch to complete this task. However, you can use Powershell. In addition, if you are on Windows RT, you need to update it. It is probably best to get a new PC.

-1
source

Source: https://habr.com/ru/post/1546451/


All Articles