It looks like you are getting the return code from cmd, rather than shutdown. Could it be that the process you spawn doesn't have it's environment correctly set up - maybe it can't see shutdown?
I'd try 1) changing my call to exec to call shutdown, with a full path, directly rather than getting cmd to do it. 2) Call a batch file instead - have the batchfile echo the environment to a file 3)Try and get the Java process to create an interactive cmd for you (maybe cmd /k) - that way you can try various commands in the same context that the Java process can. Paul > -----Original Message----- > From: andy wix [mailto:[EMAIL PROTECTED] > Sent: 25 November 2004 11:47 > To: [EMAIL PROTECTED] > Subject: OT: server shutdown > > > Hi, > > I have a requirement to allow a privelidged user to reboot > the server(WinXP > OS). > > I have code as follows: > > Runtime runtime = Runtime.getRuntime(); > Process proc = runtime.exec("cmd.exe /C shutdown -r -f -t 10"); > int exitVal = proc.waitFor(); > > When called, the server does not shut down (although I get > the exit code of > 0) but if I run the same command from the XP 'run' window it works as > expected. > > I don't think it can be an access rights thing as I can use the same > approach to set the system time and date successfully. > > Any ideas? > > Thanks, > Andy > > _________________________________________________________________ > Want to block unwanted pop-ups? Download the free MSN Toolbar now! > http://toolbar.msn.co.uk/ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]