+ 2
How to shut down a system using JavaScript
Is it possible to shutdown a device or system using JavaScript command? If possible, how can it be done? Thanks.
5 Antworten
+ 7
It is not possible to do it with browser JS. But with NodeJS you can execute the corresponding shell commands.
In windows, it will be like this
const { exec } = require('child_process');
exec('shutdown /s');
+ 2
No you can't shutdown system with JavaScript directly because it runs on browser and browsers don't have access to anything that is not inside the browser.
However, nodejs can do that because it runs on your system directly. So what @Ore mentioned.
+ 2
Thanks guys
0
Some one help me with the code for shutting down a Linux system in JavaScript