Shutdown PC w/ batch file (1hour) after program(game) launched


  1. Posts : 6
    Windows 7 x64
       #1

    Shutdown PC w/ batch file (1hour) after program(game) launched


    Is it possible to do this? I want to make it so that a game shuts down the computer after "X" seconds/minutes/hours of playing the game. But i want the file to be somewhat undetected. I don't want it popping up with a message saying things like "PC will shutdown in 3 minutes" or anything like that i just want it to have an auto shutdown or restart as if it had a virus or something was wrong with the PC.

    I know batch files can do something like this so if you guys knew a little something to help me out thanks very much for your input

    Just a little prank I'm pulling and your help would be great.
      My Computer


  2. Posts : 1,426
    7 Pro
       #2

    (i'm too lazy to create the .bat today)

    Use the Remote Shutdown Tool to Shutdown, Restart, or Logoff a Local or Networked Computer — MAXIMUMpcguides – Windows Vista tips, tricks, help, and how-to guides

    Create the .bat file with options you want, info in the link.

    Then once you're done... Modify the Game's shortcut icon to point to the .bat file... keep the original .ico in place so it looks like they're launching the game... As long as you have rights to the machine, this will do what you want.
      My Computer


  3. Posts : 6,668
    Windows 7 x64
       #3

    I think you'd have a lot more luck dealing with the task scheduler for something like this.
    Schedule a task
      My Computer


  4. Posts : 6
    Windows 7 x64
    Thread Starter
       #4

    this is what i have right now.

    @echo off

    rem Notepad
    cd C:\Program Files\game
    start game.exe
    exit

    but how do i make it shut down? where do i add the -s -t 600?
      My Computer


  5. Posts : 6,668
    Windows 7 x64
       #5

    Shutdown -s -t 3600

    3600 seconds should be one hour.
      My Computer


  6. Posts : 6
    Windows 7 x64
    Thread Starter
       #6

    okay so i got it working but how do i get rid of the warning?
      My Computer


  7. Posts : 6,668
    Windows 7 x64
       #7

    I believe adding the /f or /p modifier will both remove the user notification.
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    shutdown /?
    Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args Display help. This is the same as typing /?.
    /? Display help. This is the same as not typing any options.
    /i Display the graphical user interface (GUI).
    This must be the first option.
    /l Log off. This cannot be used with /m or /d options.
    /s Shutdown the computer.
    /r Shutdown and restart the computer.
    /g Shutdown and restart the computer. After the system is
    rebooted, restart any registered applications.
    /a Abort a system shutdown.
    This can only be used during the time-out period.
    /p Turn off the local computer with no time-out or warning.
    Can be used with /d and /f options.
    /h Hibernate the local computer.
    Can be used with the /f option.
    /e Document the reason for an unexpected shutdown of a computer.
    /m \\computer Specify the target computer.
    /t xxx Set the time-out period before shutdown to xxx seconds.
    The valid range is 0-315360000 (10 years), with a default of 30.
    If the timeout period is greater than 0, the /f parameter is
    implied.
    /c "comment" Comment on the reason for the restart or shutdown.
    Maximum of 512 characters allowed.
    /f Force running applications to close without forewarning users.
    The /f parameter is implied when a value greater than 0 is
    specified for the /t parameter.

    /d [p|u:]xx:yy Provide the reason for the restart or shutdown.
    p indicates that the restart or shutdown is planned.
    u indicates that the reason is user defined.
    If neither p nor u is specified the restart or shutdown is
    unplanned.
    xx is the major reason number (positive integer less than 256).
    yy is the minor reason number (positive integer less than 65536).
      My Computer


  8. Posts : 6
    Windows 7 x64
    Thread Starter
       #8

    @echo off


    cd C:\Program Files\game
    start game.exe
    shutdown -s -p -f -t 10
    exit


    this is what im tryin to use but the computer doesnt shut down. how should i structure this for it to work?
      My Computer


  9. Posts : 6,668
    Windows 7 x64
       #9

    The switches are different format it this way
    shutdown /p -s -t 10

    including both p and f seems redundant just try one then the other until you get the behavior you want.
      My Computer


  10. Posts : 6
    Windows 7 x64
    Thread Starter
       #10

    okay thanks also, how about shutting a network computer down?

    shutdown /m \\cool_computer /s

    should that work?
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:28.
Find Us