Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,
I have a .bat file and a want to execute it when a I press a specific Buton from a window.
Eg. When a press the yes button from a dialog box I want the .bat file to execute the command inside.

Thanks!

What I have tried:

I want to try with sysexport software for reading the button ID process.
Posted
Updated 16-Oct-20 8:07am

1 solution

You've mentioned no context for the button that you're clicking.
I'm assuming it is a winform or something because I see you've marked as C++.
So, you can use ShellExecute win api[^]
 
Share this answer
 
Comments
KRS Cristian 16-Oct-20 14:44pm    
Raddevus it's about a button from an specific software installed on my PC, based on windows 10. I would try the ShellExecute win api[^] command, this one I should insert in the batch file? Before my script inside? Excuse me, I'm newbie in this part. I could read the ID procces of that button, but how I can insert in your code "ShellExecute win api[^]"?
Dave Kreskowiak 16-Oct-20 15:04pm    
The ShellExecute api is used to launch an external process. Since you're trying to launch a batch file, you have to launch CMD.EXE and pass it the argument "/C yourBatchFile.bat. CMD is required to process and execute the commands in the batch file.
KRS Cristian 16-Oct-20 15:33pm    
Thank you, I will try your method, in case that will not work I'll ask you more ways.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900