Computer Hope

Microsoft => Microsoft DOS => Topic started by: c627627 on March 03, 2021, 10:34:46 PM

Title: How to Auto Run Keyboard Shortcuts at Windows Sartup after a pause
Post by: c627627 on March 03, 2021, 10:34:46 PM
What .bat file command run at startup accomplishes the following:

1. Pause 60 seconds to give time for a program to auto start at Windows Startup.
2. Run combo key command CTRL and ` pressed simultaneously.
3. Pause 5 seconds.
4. Run key combo key command CTRL and Enter pressed simultaneously.

Thank you.
Title: Re: How to Auto Run Keyboard Shortcuts at Windows Sartup after a pause
Post by: Gizmo on March 20, 2021, 01:00:37 AM
I started looking into this for you -  by the way I have limited knowledge of DOS + basic programming in various languages.

This command will pause for 60 seconds: timeout /t 60 /nobreak > NUL
I have tested it out and it works ok (the nobreak command prevents interruptions if a key gets pressed)

Then I started looking for the next part, combo key command CTRL and `
From what I have read, batch script cannot send keys to external windows, and there are reports that Microsoft removed SendKeys from Windows PowerShell in Windows 10.

Also, I didn't notice you had not said what those key commands were going to control - a program of some sort?

I think your best bet would be to use something like AutoIt - https://www.autoitscript.com/site/autoit

This can do what you require and more.