CMD command to choose to restart or not

Discussion in 'Windows 7' started by lunar21, Aug 27, 2009.

  1. lunar21

    lunar21 MDL Addicted

    Dec 14, 2008
    753
    270
    30
    Hello all. I was wondering if someone could tell me the cmd command code to have the person choose to restart or not to restart. Thank you soooooooooooooo much.

    Lunar21
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. ifeife2

    ifeife2 MDL Member

    Apr 25, 2008
    134
    3
    10
    What language are you programming in? .bat ?
     
  3. lunar21

    lunar21 MDL Addicted

    Dec 14, 2008
    753
    270
    30
    Yes .bat, can you help?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,770
    1,101
    60
    #4 Mr Jinje, Aug 27, 2009
    Last edited: Aug 28, 2009
    Sounds like you need that script that prompts user a yes no question

    SET /P ANSWER=Hey User Wanna Reboot (Y/N)?

    then you need some kind of if than statement

    Looks like Riddick got it.
     
  5. Riddick91

    Riddick91 MDL Novice

    Aug 26, 2009
    12
    2
    0
    @echo off

    SET /P ANSWER=Hey User Wanna Reboot (Y/N)?:

    If /I %ANSWER%==Y goto shut
    echo System doesn't restart
    pause >NUL
    exit

    :shut
    shutdown -r -t 5



    so it's gonna work ;-)
     
  6. lunar21

    lunar21 MDL Addicted

    Dec 14, 2008
    753
    270
    30
    #6 lunar21, Aug 28, 2009
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Here is what I got:
    Code:
    @echo off
    :start
    cls
    set /p answer=Do you wish to install updates? (Y/N):
    
    if %answer% == Y goto install
    if %answer% == y goto install
    if %answer% == N goto exit
    if %answer% == n goto exit
    
    :install
    echo Please wait.....
    Windows6.1-KB123334-x86.msu /quiet /norestart
    Windows6.1-KB123456-x86.msu /quiet /norestart
    Windows6.1-KB123456-v2-x86.msu /quiet /norestart
    Windows6.1-KB674103-x86.msu /quiet /norestart
    Windows6.1-KB675605-x86.msu /quiet /norestart
    Windows6.1-KB675605-v2-x86.msu /quiet /norestart
    Windows6.1-KB675606-x86.msu /quiet /norestart
    Windows6.1-KB915597-x86.exe /s /norestart
    Windows6.1-KB958488-v6001-x86.msu /quiet /norestart
    Windows6.1-KB958830-x86.msu /quiet /norestart
    Windows6.1-KB968771-x86.msu /quiet /norestart
    Windows6.1-KB971012-x86.msi /quiet /norestart
    Windows6.1-KB972636-x86.msu /quiet /norestart
    Windows6.1-KB973525-x86.msu /quiet /norestart
    Windows6.1-KB973751-x86.msu /quiet /norestart
    Windows6.1-KB973874-x86.msu /quiet /norestart
    Windows6.1-KB974039-v2-x86.msu /quiet /norestart
    Windows6.1-KB974138-x86.msu /quiet /norestart
    Windows6.1-KB974176-x86.msu /quiet /norestart
    Windows6.1-KB974179-x86.msu /quiet /norestart
    Windows6.1-KB974204-x86.msu /quiet /norestart
    Windows6.1-KB974204-v2-x86.msu /quiet /norestart
    Windows6.1-KB974324-x86.msu /quiet /norestart
    Windows6.1-KB974327-x86.msu /quiet /norestart
    Windows6.1-KB974332-x86.msu /quiet /norestart
    Windows6.1-KB974638-x86.msu /quiet /norestart
    goto end
    
    :end
    cls
    set /p answer=Do you wish to restart? (Y/N):
    
    if %answer% == Y goto shutdown
    if %answer% == y goto shutdown
    if %answer% == N goto exit
    if %answer% == n goto exit
    
    :shutdown
    shutdown /r /f /t 5
    
    :exit
    exit
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Reign_Of_Freedom

    Reign_Of_Freedom MDL Expert

    Aug 1, 2009
    1,247
    467
    60
    #7 Reign_Of_Freedom, Aug 28, 2009
    Last edited: Aug 28, 2009
    I believe i have the Batch file all ready i can upload it if i find it.

    Edit : Nope i guess i deleted it =(
     
  8. lunar21

    lunar21 MDL Addicted

    Dec 14, 2008
    753
    270
    30
    Well what I posted above works perfectly. I was able to add all of the W7 updates, but the .cab file. Is there a way to install .cab files like the one in the W7 updates?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. tomorrow

    tomorrow MDL Addicted

    Jul 3, 2008
    723
    263
    30
    There is:
    Via DISM - C:\Windows\System32\Dism.exe /Online /Add-Package /PackagePath:”C:\Windows6.1-KB974333-x86.cab”
    Via Pkgmgr.exe - Dont remember syntax...sorry :p

    Neither worked on this .cab tho
     
  10. lunar21

    lunar21 MDL Addicted

    Dec 14, 2008
    753
    270
    30
    Well I think because inside a .cab file is supposed to me a .ini file. Well there is no .ini in this cab file.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...