Auto logoff PC in given time

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..

Replies

  • gaurav.bhorkar
    gaurav.bhorkar
    Are you looking for the MS DOS command?

    "shutdown -s -t 10" - To shutdown the computer after 10 seconds.
  • karthie
    karthie
    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.
  • gaurav.bhorkar
    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 
    #include 
    
    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.
  • durga ch
    durga ch
    unix has corn jobs which can be set up. Not sure of windows though
  • MaRo
    MaRo
    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 
    #include 
    
    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().
  • saurabh2486
    saurabh2486
    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?
    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?
    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

You are reading an archived discussion.

Related Posts

Hi CEans am 2nd year Mechanical Students having a fair amount of knowledge of what I studied till now I want to ask u guys some help so that after...
Can any one have better idea about the greedy aproach and dynamic programming in algorithm and also give the link from where we find ideas about design technique of algorithm........
Let us play with time: write a program to find index of smallest no in an array? The one whose program will take minimum execution time and with smallest exe...
Dream Spark Yatra: Chennai(Genuine Microsoft Software for free) Microsoft Dreamspark Yatra - Chennai 2010, is a premier technological event hosted by Microsoft Chennai .NET User Group (Student) and Microsoft Student...
Hi. I 'm a student for Computer Since.i wanted to do a mini project in mobille programming with vb.net. Please help me with any idea.