• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Windows 2000 Plateform...

 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can anyone please explain how to shutdown windows 2000 using java program. Well on MSDN I found one method which can shutdown windows.

DWORD WINAPI InitiateShutdown(
LPTSTR lpMachineName,
LPTSTR lpMessage ,
DWORD dwGracePeriod,
DWORD dwShutdownFlags,
DWORD dwReason
);

Is there any dll file available for this. I found one dll file csWindowsShutdown.dll. When I load this dll, then runtime system throws an Error says mscoree.dll not found.

Is there any alternate way of doing this?

Thanks & Regards

Naseem
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Windows has a SHUTDOWN command, which you can execute using Runtime.exec.
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf...

It worked as you have explained.



java Shutdown shutdown /L /T:10

This shutdown my computer in 10 seconds.

Thanks once again


Regards


Naseem
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the description in the Windows API reference on MSDN, it tells you in which DLL this function is: advapi32.dll.

Note that the description also says Requires Windows Vista / Requires Windows Server "Longhorn", so this is most likely not going to work on Windows 2000 anyway. You should use the function ExitWindowsEx instead.

See also: Shutting Down on MSDN.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic