Batch file that opens a program, wait 5 seconds, then press 2 keyboard keys -
i have windows 10 pro.
i need .bat file open teamspeak.exe, wait 5 seconds, , press hotkey "insert" , press combination "ctrl + delete" in order mute microfone , sound. searched code , did not work me:
@if (@codesection == @batch) @then @echo off cscript //nologo //e:jscript "%~f0" start ts3client_win64.exe -nc goto :eof @end ping 1.1.1.1 -n 1 -w 4000 > nul wscript.createobject("wscript.shell").sendkeys("{insert}");
when run in cmd, error msg:
c:\program files\teamspeak 3 client\test.bat(1, 6) compilation error microsoft jscript: ';' expected
you can use powershell (see provide input applications powershell)
add-type -assemblyname microsoft.visualbasic add-type -assemblyname system.windows.forms start-process "c:/path/to/teamspeak.exe" start-sleep -seconds 5 [microsoft.visualbasic.interaction]::appactivate("teamspeak") [system.windows.forms.sendkeys]::sendwait("{insert}") [system.windows.forms.sendkeys]::sendwait("^{delete}")
worked me notepad , file argument.
Comments
Post a Comment