How do i run batch from the web locally?
I'm trying to kill a process locally (sas.exemy own file) but from web.
-
7Think about the security and usability implications if websites were allowed to kill arbitrary processes on your machine. That would be a disaster.Carcigenicate– Carcigenicate2025-05-18 19:01:42 +00:00Commented May 18 at 19:01
-
Neither a batch file or cmd.exe is required to 'kill' a task/process. There are independent utilities already in your Operating System designed for just that.Compo– Compo2025-05-18 23:11:59 +00:00Commented May 18 at 23:11
1 Answer
You can't. JavaScript code running in the browser has a very limited scope.
This requires a client application to which you send the request. The client runs directly on the operating system, so it has the ability to execute CMD commands and can therefore also stop processes.
You can issue the command to stop sas.exe from the website; this request can reach the server, and from the server, you need to be able to communicate with the desktop client application to request the process termination. So, it's not impossible, but on its own, a website cannot execute such a command.
If you're hosting the website on your own machine, you can issue the command from the web, and even without a client application, the backend server may be able to execute actions like stopping an sas.exe process. However, this can only be executed on the server.