batch file question

Page 1 of 2 12 LastLast

  1. Posts : 11
    7 64 bit
       #1

    batch file question


    I have a batch file to restart windows and want to do on a schedule.

    shutdown.exe /r /t 00

    But when i try it manually or try to restart from start/restart there are programs running in the background and i have to force restart. What do i add to the batch file to stop the programs or force restart
      My Computer


  2. Posts : 2,468
    Windows 7 Ultimate x64
       #2

    The /f switch does exactly that, forcing a shutdown instead of waiting for programs to close gracefully

    Code:
    shutdown.exe /r /f
    Note that, running programs will be killed immediately, without chance of saving anything. Data loss might occur is something was yet to be saved.
      My Computer


  3. Posts : 11
    7 64 bit
    Thread Starter
       #3

    Alejandro85 said:
    The /f switch does exactly that, forcing a shutdown instead of waiting for programs to close gracefully

    Code:
    shutdown.exe /r /f
    Note that, running programs will be killed immediately, without chance of saving anything. Data loss might occur is something was yet to be saved.
    Thanks. What does the t 00 mean in my original file

    the /r f/ is reboot force?
      My Computer


  4. Posts : 2,468
    Windows 7 Ultimate x64
       #4

    Dayd said:
    What does the t 00 mean in my original file
    It's a timeout, indicating how much time to wait before attempting to close all programs, according to help. In theory, it should close everything immediately (after 0 seconds), but it's not working in your case.


    Dayd said:
    the /r f/ is reboot force?
    Yes. /r means restart, and /f stands for force.

    When on doubt, ask for help in the command line:

    Code:
    shutdown /?
    This will show all valid switches and their meaning.
      My Computer


  5. Posts : 11
    7 64 bit
    Thread Starter
       #5

    @echo off


    start "" "C:\Windows\System32\SystemPropertiesProtection.exe"

    starts system restore.


    Is there a switch that will open the box to type name for restore point like clicking the create button does?

    Thanks
      My Computer


  6. Posts : 11
    7 64 bit
    Thread Starter
       #6

    Alejandro85 said:
    Dayd said:
    What does the t 00 mean in my original file
    It's a timeout, indicating how much time to wait before attempting to close all programs, according to help. In theory, it should close everything immediately (after 0 seconds), but it's not working in your case.


    Dayd said:
    the /r f/ is reboot force?
    Yes. /r means restart, and /f stands for force.

    When on doubt, ask for help in the command line:

    Code:
    shutdown /?
    This will show all valid switches and their meaning.
    you mean from a command prompt? it does not show switches to me it tries to shut down?
      My Computer


  7. Posts : 2,468
    Windows 7 Ultimate x64
       #7

    Dayd said:
    @echo off


    start "" "C:\Windows\System32\SystemPropertiesProtection.exe"

    starts system restore.


    Is there a switch that will open the box to type name for restore point like clicking the create button does?

    Thanks
    No idea really. But most important, that's NOT a command line application, but a full GUI. Using system restore from a command line should have another, CLI program to that purpose. I don't know how, but Google a bit and maybe you'll find alternatives.


    Dayd said:
    you mean from a command prompt? it does not show switches to me it tries to shut down?
    Yes, it's a standard that the /? switch shows helps but does nothing at all. Like this:
    batch file question-cmdhelpswitch.png
      My Computer


  8. Posts : 11
    7 64 bit
    Thread Starter
       #8

    [QUOTE=Alejandro85;2850683]
    Dayd said:
    No idea really. But most important, that's NOT a command line application, but a full GUI. Using system restore from a command line should have another, CLI program to that purpose. I don't know how, but Google a bit and maybe you'll find alternatives.
    Ok thanks

    I do not know much about command line application as you have noticed. I got those two on the web

    EDIT: Got it. I was doing shutdown /? from C:\users\username instead of from C:\
      My Computer


  9. Posts : 6,285
    Windows 10 Pro X64
       #9

    Dayd said:
    @echo off


    start "" "C:\Windows\System32\SystemPropertiesProtection.exe"

    starts system restore.


    Is there a switch that will open the box to type name for restore point like clicking the create button does?

    Thanks
    That doesn't start System Restore, it opens the System Properties dialog on the System Protection tab.
      My Computer


  10. Posts : 11
    7 64 bit
    Thread Starter
       #10

    It is the quickest way i know to get to system restore in one click. From the system protection tab create can be clicked. If you know a quicker way to open to the create box please tell
    Attached Thumbnails Attached Thumbnails batch file question-sysres.jpg  
      My Computer


 
Page 1 of 2 12 LastLast

  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 17:02.
Find Us