Windows – How to run a script, and then emulate ^V with Auto Hot Key (AHK)

autohotkeykeyboard shortcutswindows 7

I have a script (batch file) to store some inside clipboard, and I need to automatize running and pasting action with auto hot key.

I tried the following code, but the code doesn't work with cmd.exe. I expect a function something like 'Paste clipboard'.

+F2::
Run "SCRIPT.bat"
Send {Control down}V{Control up}
Return

Best Answer

In a Command Prompt, Ctrl+V doesn't paste the clipboard.

One way you can paste the clipboard in a Command Prompt is Alt+Space, E, P. So you might try

Send !{Space}ep

To paste to other Windows programs as well, you can check if the current window is a Command Prompt or not as follows

IfWinActive, ahk_class ConsoleWindowClass
{
  Send !{Space}ep
}
Else
{
  Send ^v
}
Related Question