Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: writing a simple batch file to shutdown pc in x minutes  (Read 4850 times)

0 Members and 1 Guest are viewing this topic.

jami.francis

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    writing a simple batch file to shutdown pc in x minutes
    « on: May 21, 2012, 07:25:00 PM »
    Hi - I currently have many xp shortcuts in a folder that allow me to shut down my pc in x number of seconds   For example I'm using C:\WINDOWS\system32\shutdown.exe -f -s -t 2400   in a shortcut to shut down in 40 minutes. 

    I'm trying to write a batch file that will prompt me for the number of MINUTES in which the pc should shut down.

    Can some one help me fill in the blanks here - I don't know what I'm doing...  thanks, Jami

    @echo off
    echo Minutes until shut down?
    echo.
    rem enter minutes press - then hit enter
    set /p min=[promptString]

    rem multiplies minutes by 60 for seconds (sec)

    rem drops the product into the shutdown statement
    C:\WINDOWS\system32\shutdown.exe -f -s -t sec



    Helpmeh



      Guru

    • Roar.
    • Thanked: 123
      • Yes
      • Yes
    • Computer: Specs
    • Experience: Familiar
    • OS: Windows 8
    Re: writing a simple batch file to shutdown pc in x minutes
    « Reply #1 on: May 21, 2012, 08:12:47 PM »
    Code: [Select]
    @echo off
    echo Minutes until shut down?
    echo.
    set /p min=Minutes:
    set /a sec=%min%*60
    shutdown -s -f -t %sec%
    Where's MagicSpeed?
    Quote from: 'matt'
    He's playing a game called IRL. Great graphics, *censored* gameplay.