You can use this hybrid bat with vbs to do this with you, just save as file.cmd
:
<!-- ::
@echo off & type "C:\folder\path\your\textFile.txt"| clip
"%windir%\system32\WScript.exe" "%~dpnx0?.wsf" && goto :EOF || rem :: -->
<job><script language="vbscript">Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run ("""C:\\Program Files\\aProgram.exe"""),9
WScript.Sleep 3000: WshShell.SendKeys "^+v": </script></job>
The code above opens your program, edit this path below and according to the location of the program using \\
instead \
:
C:\\Program Files\\aProgram.exe
You also need to edit the path to your textFile.txt
:
@echo off & type "C:\folder\path\your\textFile.txt" | clip
You may need to adjust the timeout on:
WScript.Sleep 3000
For do the same in PowerShell
Get-Content -path "C:\folder\path\your\textFile.txt" | Set-Clipboard
Start-Process -FilePath 'C:\\Program Files\\aProgram.exe'
Start-Sleep -m 700
$wshell = New-Object -ComObject wscript.shell
$wshell.AppActivate('add here the aProgram.exe windows name')
Start-Sleep -m 700
[System.Windows.Forms.SendKeys]::SendWait("^{v}")
You also need to edit the path to your textFile.txt
:
Get-Content -path "C:\folder\path\your\textFile.txt" | Set-Clipboard
You may need to adjust the timeout on:
Start-Sleep -m 700