Create hidden cmd javascript

I’m looking for a way to run a cmd command without showing the cmd window to the user.

I’m using something like:

    function reboot()  {
          var ws = new ActiveXObject("WScript.Shell");
          ws.Exec("shutdown.exe -r -t 120");


But it still shows the window, is there anyway not to show it?



Try using the Run function instead of Exec and pass it 0 as the second argument to prevent it showing the command prompt window:

ws.Run("shutdown.exe -r -t 120", 0);

The System Shutdown window will still be displayed (I don’t think there is any way to suppress that).