回复 5# wyhs4000
SendKeys.ps1 | param([byte]$Key,[byte]$Shift) | | Add-Type @" | | using System; | | using System.Runtime.InteropServices; | | public class Keyboard { | | [DllImport("user32.dll")] | | private static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo); | | Keyboard(){} | | public static void Sendkeys(byte key, byte shift = 0){ | | if(shift == 0){ | | keybd_event(key, 0, 0, 0); | | keybd_event(key, 0, 2, 0); | | }else{ | | keybd_event(shift, 0, 0, 0); | | keybd_event(key, 0, 0, 0); | | keybd_event(key, 0, 2, 0); | | keybd_event(shift, 0, 2, 0); | | } | | } | | } | | "@; | | [Keyboard]::Sendkeys($Key,$Shift) # Ctrl=17;97=Num1COPY |
Run.vbs | function KeyBoard(byval vkey,byval shift) | | set ws=createobject("Wscript.Shell") | | ws.run "powershell -noprofile -executionpolicy bypass -file "&chr(34)& "SendKeys.ps1"&chr(34)&chr(32)&vKey&chr(32)&Shift,0 | | end function | | | | KeyBoard 101,0COPY |
|