shutdown or reboot computer

J

Jochen Friedmann

Hello,

how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?
 
A

Anno Siegel

Jochen Friedmann said:
Hello,

how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?

First answer the question how to reboot, shut down, or change the user
by any any means in your OS. Then ask yourself how to do the same things
in Perl.

Anno
 
J

Jochen Friedmann

Oh, sorry

the OS is Win2000 or WinnNT

Anno Siegel said:
Script ?

First answer the question how to reboot, shut down, or change the user
by any any means in your OS. Then ask yourself how to do the same things
in Perl.

Anno
 
K

ko

Jochen said:
Hello,

how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?

Please read the posting guidelines under what you 'Really Really Should'
do before posting - you may find your answer quicker that way:

http://mail.augustmail.com/~tadmc/clpmisc.shtml

Google search in comp.lang.perl.misc for 'windows shutdown' group (2nd
match) turns up the following (may be wrapped):

http://groups.google.com/[email protected]&rnum=2

Or you could have tried 'perldoc win32' and found the Win32
InitiateSystemShutdown() function.

HTH - keith
 
C

Cyde Weys

Jochen said:
Hello,

how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?

system('shutdown -h now');
system('reboot');
system("su -l $newUser");
 
T

Thomas Kratz

Thomas Kratz said:
The script below provides two functions for reboot and shutdown and should work for nt to xp.

Thomas

I forgot to mention, that prior to calling Reboot or Powerdown, you'll have to call AdjustToken() first and check for success. And the print statements should be removed for production :)

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top