Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Windows 2000 Plateform...

 
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Yeah, but does being a ninja come with a dental plan? And what about this tiny ad?
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic