Link to home
Start Free TrialLog in
Avatar of Shank1
Shank1

asked on

JavaScript ActiveXObject using WScript.shell to run shutdown.exe command

I am trying to write a function using Java Script that utilizes an Active X control to shutdown a windows box.  The plan is to imbed this webpage as part of the active desktops on some windows lab machines so users will reboot when they are done with a machine.  Here is my code that I am having problems with:

 <SCRIPT LANGUAGE="JavaScript">
function reboot()  {
      var ws = new ActiveXObject("WScript.Shell");
      ws.Exec("shutdown.exe -r -t 30 -f -c Testing_Testing");

}
</script>

I basically want the users to see a little message when this function gets called by the button on the desktop.  I am having problems with the -c switch of the shutdown command.  I want to be able to write the message without the _ between each of the words.  Is there a way that I can type a message without the _ between each word?  I have tried using single quotes ' ' and brackets [] around the message and neither have worked.
ASKER CERTIFIED SOLUTION
Avatar of TheMCSE
TheMCSE

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial