How can I run a program or batch file on the client side?
From Javascript? You can't. It's a security risk. Think about it - would you want every website to be able to run programs on your PC?
How do I create and execute batch file in client machine using server side code?
Try using applet.
Lauching .bat or .exe client-side
The technology exists for YEARS and it's called ClickOnce.
https://msdn.microsoft.com/en-us/library/142dbbz4%28v=vs.90%29.aspx
It requires the .NET Framework at the client side and a support from a browser (some browsers require a plugin to correctly handle ClickOnce apps).
Applications are deployed either in a form of a self-extracting installer (setup.exe
) or a link to an XML document, the manifest, that describes location of other components (appname.application
). In any case, a client just clicks a link, the app is downloaded and run locally, using local client permissions.
In particular, the app can read/write local files, use certificates from the local store, print documents using local printers, call other services ever if they are cross-domain etc.
And note that such ClickOnce application can run client local processes without any restrictions. We use this feature for years and it sounds like this is exactly your scenario.
How can I run a program from a batch file without leaving the console open after the program starts?
You can use the exit keyword. Here is an example from one of my batch files:
start myProgram.exe param1
exit
Is it possible to run an .exe or .bat file on 'onclick' in HTML
Here's what I did. I wanted a HTML page setup on our network so I wouldn't have to navigate to various folders to install or upgrade our apps. So what I did was setup a .bat file on our "shared" drive that everyone has access to, in that .bat file I had this code:
start /d "\\server\Software\" setup.exe
The HTML code was:
<input type="button" value="Launch Installer" onclick="window.open('file:///S:Test/Test.bat')" />
(make sure your slashes are correct, I had them the other way and it didn't work)
I preferred to launch the EXE directly but that wasn't possible, but the .bat file allowed me around that. Wish it worked in FF or Chrome, but only IE.
Related Topics
Javascript - Remove Milliseconds from Date Object
Prevent Form Submission on Enter Key Press
Stop Just One Dropdown Toggle from Closing on Click
React-Native React-Navigation Undefined Is Not an Object (Evaluating 'S.Value.Startswith')
Formdata Created from an Existing Form Seems Empty When I Log It
How to Get the Index from a Json Object With Value
How to Redirect to Another Page Using Angularjs
Disable Right-Clicking in Html5 Video
Typescript - Possible to Disable Type Checking
How to Build Pdf File from Binary String Returned from a Web-Service Using JavaScript
Sort Json Data Based on Date and Time
Npm Warn Enoent Enoent: No Such File or Directory, Open 'C:\Users\Nuwanst\Package.Json'
Launch Chrome Browser from Internet Explorer
Use Lodash to Find Objects in an Array Matches an Id (Complex, Drilldown)
How to Sort Data in Ascending or Descending Order in Reactjs
Jquery Datatables: Hide Search Bar
For Loop With Two Array in JavaScript
How to Combine Object Values from Separate Lines into One Line