1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is there a way to run a batch file just as a user is logging off?

Discussion in 'Windows XP' started by Roger Smith III, Mar 1, 2010.

  1. Roger Smith III

    Roger Smith III Flightless Bird

    I know that you can write DOS batch files, and place them in the startup
    folder. When the user logs in, the batch file executes.

    Is there a way to have a batch file execute when a user logs off? We need
    to find a way to copy some files up to a server, when a user logs off for the
    day.

    Thanks
    Rog
     
  2. boatman312

    boatman312 Flightless Bird

    Re: Is there a way to run a batch file just as a user is loggingoff?

    On 03/01/10 5:47 AM, Roger Smith III wrote:
    > I know that you can write DOS batch files, and place them in the startup
    > folder. When the user logs in, the batch file executes.
    >
    > Is there a way to have a batch file execute when a user logs off? We need
    > to find a way to copy some files up to a server, when a user logs off for the
    > day.
    >
    > Thanks
    > Rog
    >


    The trick is to write a batch file that includes the backup process
    first, then logs the user off.


    http://www.microsoft.com/windowsxp/using/helpandsupport/learnmore/ballew_commandline.mspx

    Shut Down the System

    Although shutting down the computer from the Start menu is faster and
    easier, the shutdown command can also be issued at a command prompt to
    shut down the computer. The shutdown command also offers parameters to
    log off a user, restart the computer, and abort a system shutdown. If
    you ever have to boot to the command-line to troubleshoot a problem,
    you'll want to know how this command works. To shut down the computer
    and experiment with other options:

    1.
    Close all open programs to avoid loss of data.

    2.
    Open Command Prompt from the shortcut created in the previous section or
    by clicking Start, pointing to All Programs, pointing to Accessories,
    and clicking Command Prompt.

    3.
    At the command prompt, type shutdown -s. Press Enter or Return on the
    keyboard. A shutdown dialog box opens.

    4.
    To abort the shutdown in progress, at the command prompt, type shutdown -a.

    Other options include -r to restart the system, -m \\computername to
    shut down a remote computer, and -l to log off of the computer. To see
    all the options, type shutdown /? at the command prompt.
     
  3. Jose

    Jose Flightless Bird

    On Mar 1, 5:47 am, Roger Smith III
    <RogerSmith...@discussions.microsoft.com> wrote:
    > I know that you can write DOS batch files, and place them in the startup
    > folder.  When the user logs in, the batch file executes.
    >
    > Is there a way to have a batch file execute when a user logs off?  We need
    > to find a way to copy some files up to a server, when a user logs off forthe
    > day.
    >
    > Thanks
    > Rog


    Do you know that you can add a log off script (or batch file) to the
    Group Policy for users?

    When the user logs off, the additional log off commands will be
    executed - and it will indicate that on the screen so you can test it
    easily with a simple batch file to just copy a file from point A to
    point B.

    http://technet.microsoft.com/en-us/library/cc781354(WS.10).aspx

    You can do some Google searches for "xp logoff scripts" and similar
    phrases to see what other people do.
     

Share This Page