shutdown or reboot computer

Discussion in 'Perl Misc' started by Jochen Friedmann, Sep 15, 2003.

  1. Hello,

    how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?
     
    Jochen Friedmann, Sep 15, 2003
    #1
    1. Advertising

  2. Jochen Friedmann

    Anno Siegel Guest

    Jochen Friedmann <> wrote in comp.lang.perl.misc:
    > 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
     
    Anno Siegel, Sep 15, 2003
    #2
    1. Advertising

  3. Oh, sorry

    the OS is Win2000 or WinnNT

    "Anno Siegel" <-berlin.de> wrote in message
    news:bk478o$lt4$-Berlin.DE...
    > Jochen Friedmann <> wrote in

    comp.lang.perl.misc:
    > > 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
     
    Jochen Friedmann, Sep 15, 2003
    #3
  4. Jochen Friedmann

    ko Guest

    Jochen Friedmann wrote:

    > 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/groups?q=w...=E16x2.3175$&rnum=2

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

    HTH - keith
     
    ko, Sep 15, 2003
    #4
  5. Jochen Friedmann

    Cyde Weys Guest

    Jochen Friedmann wrote:
    > 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");
     
    Cyde Weys, Sep 15, 2003
    #5
  6. Jochen Friedmann

    Thomas Kratz Guest

    "Thomas Kratz" <> wrote in news:...

    >
    > "Jochen Friedmann" <> wrote in news:bk48ef$e0k$...

    > > Oh, sorry
    > >
    > > the OS is Win2000 or WinnNT
    > >

    >
    > 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
     
    Thomas Kratz, Sep 15, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe Longo

    How to Reboot ?

    Joe Longo, Oct 14, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    566
    Kumar Gaurav Khanna [C# MVP]
    Oct 16, 2003
  2. Ken Tucker
    Replies:
    0
    Views:
    1,700
    Ken Tucker
    Jul 5, 2003
  3. Replies:
    3
    Views:
    1,014
  4. Håkan Hagenrud

    Shutdown Mac OSX computer using python

    Håkan Hagenrud, Dec 8, 2008, in forum: Python
    Replies:
    2
    Views:
    2,116
  5. xyz-2041
    Replies:
    17
    Views:
    759
    Richard Bos
    Jun 23, 2009
Loading...

Share This Page