Forum > General

Is it possible to run batch file with a keypress ?


On Windows 10,

I'd like to run some specific applications (e.g. FCGI or HTTPServer application) in following way:

- first stop the server
- Compile the file
- Start the server

with just pressing F9,  etc.

Is this possible?

I think so - see Project Options > Compiler Options for optional Execute BEFORE and Execute AFTER commands.

As already said, in Options for project, Compiler commands, just check (on)"Build" in (on)"Execute after", and paste your command line in order to call your *.bat file. For information (under Linux anyway) the script cannot be interactive e.g. "read sResponse; case "$sResponse ...\...". I'm using one, just to copy and paste the compiled *.elf into a kind of "files server directory" (could be a "CGI-bin directory"). And the last script's echo cmd should\will be displayed at the end\after of the compilation, in the Lazarus IDE itself.

Thank you for your replies.
I have set up the "Compiler Command" options. 
I cannot enter all the command directly. My command is:

         d:\nssm\nssm.exe stop aqrun 

But using above command directly in the ExecuteBefore.command did not work. I tried to quote with single quotation and double quotation, but none of them worked.

So, I put my command in the batch file named StartAQRun.bat, and called it in the BeforeExecute.command. This works.


[0] Message Index

Go to full version