CrazyEngineers
  • Auto logoff PC in given time

    karthie

    Member

    Updated: Oct 25, 2024
    Views: 968
    Hi friends,

    Is there any code to auto logoff the PC in given time? I have seen some software to logoff, shutdown, restart the PC automatically. But I need some coding in any language to do so, by showing the alert msg that the system is going to logoff in some seconds.. like that..
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • gaurav.bhorkar

    MemberMar 5, 2010

    Are you looking for the MS DOS command?

    "shutdown -s -t 10" - To shutdown the computer after 10 seconds.
    Are you sure? This action cannot be undone.
    Cancel
  • karthie

    MemberMar 5, 2010

    No, we can use the batch file "shutdown -s -t 10" to logoff the PC by clicking it. But I need a program which runs automatically once we login the system by setting the logoff time. For eg: you can see this in Sify Iway.
    Are you sure? This action cannot be undone.
    Cancel
  • gaurav.bhorkar

    MemberMar 5, 2010

    Well I don't have any idea about SifyIway.

    You can use this "shutdown" command in a C program also with the help of "system()" function.

    Let me give an example program:

    #include <stdio.h>
    #include <stdlib.h>
    
    void main ()
    {
        system ("shutdown -s -t 60");
    }
    Copy the exe file of this program into the StartUp folder in Start Menu.
    The computer will shutdown after 60 seconds each time it starts.
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberMar 5, 2010

    unix has corn jobs which can be set up. Not sure of windows though
    Are you sure? This action cannot be undone.
    Cancel
  • MaRo

    MemberMar 6, 2010

    gaurav.bhorkar
    Well I don't have any idea about SifyIway.

    You can use this "shutdown" command in a C program also with the help of "system()" function.

    Let me give an example program:

    #include <stdio.h>
    #include <stdlib.h>
    
    void main ()
    {
        system ("shutdown -s -t 60");
    }
    Copy the exe file of this program into the StartUp folder in Start Menu.
    The computer will shutdown after 60 seconds each time it starts.
    That's right, more for letting user enters a specific time hh:mm:ss, just get the current time & subtract from the given time convert to seconds & pass it to system().
    Are you sure? This action cannot be undone.
    Cancel
  • saurabh2486

    MemberMar 11, 2010

    yes there is a command check this out this might help

    Microsoft DOS shutdown command

    Quick links
    #-Link-Snipped-#
    #-Link-Snipped-#
    #-Link-Snipped-#
    #-Link-Snipped-##-Link-Snipped-#
    About shutdown
    Enables a user to shutdown a Windows XP computer from the command line as well as perform additional features that are not available through Windows.

    [​IMG]Availability
    The shutdown.exe command is an #-Link-Snipped-# available in the below Microsoft Windows operating systems.
    #-Link-Snipped-#
    #-Link-Snipped-#
    #-Link-Snipped-#




    Index
    Category:
    #-Link-Snipped-#

    Companies:
    #-Link-Snipped-#

    Related Pages:

    Resolved
    Were you able to locate the answer to your questions?
    • <a href="https://www.computerhope.com/cgi-bin/feedback.cgi?yes" target="_blank" rel="nofollow noopener noreferrer">Computer Hope Feedback</a>
    • <a href="https://www.computerhope.com/cgi-bin/feedback.cgi?no" target="_blank" rel="nofollow noopener noreferrer">Computer Hope feedback and recommendations</a>
    Syntax
    Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
    No args Display this message (same as -?)-iDisplay GUI interface, must be the first option-lLog off (cannot be used with -m option)-sShutdown the computer-rShutdown and restart the computer-aAbort a system shutdown-m \\computernameRemote computer to shutdown/restart/abort-t xxSet timeout for shutdown to xx seconds-c "comment"Shutdown comment (maximum of 127 characters)-fForces running applications to close without warning-d [p]:xx:yyThe reason code for the shutdown
    u is the user code
    p is a planned shutdown code
    xx is the major reason code (positive integer less than 256)
    yy is the minor reason code (positive integer less than 65536)Examples
    shutdown -r -c "Rebooting for latest updates."
    This would display a Windows System Shutdown window for 30 seconds, warning the user that the computer is going to shutdown and then restart the computer.
    shutdown -i
    Ran from either the command line or from the Windows run line this option would open the remote shutdown dialog Window. See #-Link-Snipped-# for additional information and an example of this window.
    Additional information
    • If you are running Microsoft Windows 95, 98, NT, or 2000 and/or you wish to find out other methods of restarting or shutting down your computer from the command prompt, please see #-Link-Snipped-#.
    • See #-Link-Snipped-# for additional information about remotely shutting down a computer in Windows.
    Microsoft DOS shutdown command

    Quick links
    #-Link-Snipped-#
    #-Link-Snipped-#
    #-Link-Snipped-#
    #-Link-Snipped-##-Link-Snipped-#
    About shutdown
    Enables a user to shutdown a Windows XP computer from the command line as well as perform additional features that are not available through Windows.

    [​IMG]Availability
    The shutdown.exe command is an #-Link-Snipped-# available in the below Microsoft Windows operating systems.
    #-Link-Snipped-#
    #-Link-Snipped-#
    #-Link-Snipped-#




    Index
    Category:
    #-Link-Snipped-#

    Companies:
    #-Link-Snipped-#

    Related Pages:

    Resolved
    Were you able to locate the answer to your questions?
    • <a href="https://www.computerhope.com/cgi-bin/feedback.cgi?yes" target="_blank" rel="nofollow noopener noreferrer">Computer Hope Feedback</a>
    • <a href="https://www.computerhope.com/cgi-bin/feedback.cgi?no" target="_blank" rel="nofollow noopener noreferrer">Computer Hope feedback and recommendations</a>
    Syntax
    Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
    No args Display this message (same as -?)-iDisplay GUI interface, must be the first option-lLog off (cannot be used with -m option)-sShutdown the computer-rShutdown and restart the computer-aAbort a system shutdown-m \\computernameRemote computer to shutdown/restart/abort-t xxSet timeout for shutdown to xx seconds-c "comment"Shutdown comment (maximum of 127 characters)-fForces running applications to close without warning-d [p]:xx:yyThe reason code for the shutdown
    u is the user code
    p is a planned shutdown code
    xx is the major reason code (positive integer less than 256)
    yy is the minor reason code (positive integer less than 65536)Examples
    shutdown -r -c "Rebooting for latest updates."
    This would display a Windows System Shutdown window for 30 seconds, warning the user that the computer is going to shutdown and then restart the computer.
    shutdown -i
    Ran from either the command line or from the Windows run line this option would open the remote shutdown dialog Window. See #-Link-Snipped-# for additional information and an example of this window.
    Additional information
    • If you are running Microsoft Windows 95, 98, NT, or 2000 and/or you wish to find out other methods of restarting or shutting down your computer from the command prompt, please see #-Link-Snipped-#.
    • See #-Link-Snipped-# for additional information about remotely shutting down a computer in Windows.
    Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

    No args Display this message (same as -?)-iDisplay GUI interface, must be the first option-lLog off (cannot be used with -m option)-sShutdown the computer-rShutdown and restart the computer-aAbort a system shutdown-m \\computernameRemote computer to shutdown/restart/abort-t xxSet timeout for shutdown to xx seconds-c "comment"Shutdown comment (maximum of 127 characters)-fForces running applications to close without warning-d [p]:xx:yyThe reason code for the shutdown
    u is the user code
    p is a planned shutdown code
    xx is the major reason code (positive integer less than 256)
    yy is the minor reason code (positive integer less than 65536)here switch -l is used for logoff rest if u need to understand ask me
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register