Execute commands at the push of a button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Execute commands at the push of a button

I'm looking to learn how to execute terminal commands at the push of a button. What programming language would be best for learning to do that?

6th Jan 2018, 4:06 AM
Kieren Baillie
Kieren Baillie - avatar
9 Answers
+ 13
Oh, I see. So you want to run the batch files from an Intranet site. Here, try this: https://stackoverflow.com/questions/18980957/is-it-possible-to-run-an-exe-or-bat-file-on-onclick-in-html
6th Jan 2018, 4:32 AM
jay
jay - avatar
+ 8
Creating a batch file will accomplish this task. Simply open a new text file, enter the commands you wish to run (each on its own line) and save the file with the extension .bat This article may help you: https://fossbytes.com/what-is-a-batch-file-in-windows-how-to-create-a-batch-file/
6th Jan 2018, 4:27 AM
jay
jay - avatar
+ 8
well, I wouldn't recommend having a command such as that in a batch file, but the browser shouldn't care/be able to see what is in the batch file. Anyway, glad I could point you in a(?) direction.
6th Jan 2018, 4:40 AM
jay
jay - avatar
+ 6
Windows or Linux?
6th Jan 2018, 4:22 AM
jay
jay - avatar
+ 6
And by push of a button. Do you mean like a key on the keyboard, or icon on the screen?
6th Jan 2018, 4:25 AM
jay
jay - avatar
+ 1
Windows
6th Jan 2018, 4:23 AM
Kieren Baillie
Kieren Baillie - avatar
+ 1
icon on the screen
6th Jan 2018, 4:25 AM
Kieren Baillie
Kieren Baillie - avatar
+ 1
already made the .bat files, to many in to many different folders is the problem, I'm learning HTML and JS in hope of building a site to keep better track of things.
6th Jan 2018, 4:29 AM
Kieren Baillie
Kieren Baillie - avatar
0
that does look like what I'm after, thanks, also looks like what I'm after may be impossible given they don't want browsers running "format c:" I'll just have to try it.
6th Jan 2018, 4:36 AM
Kieren Baillie
Kieren Baillie - avatar