Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: batch file question

09 Aug 2014   #1
Dayd

7 64 bit
 
 
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 System SpecsSystem Spec
.
09 Aug 2014   #2
Alejandro85

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
09 Aug 2014   #3
Dayd

7 64 bit
 
 

Quote   Quote: Originally Posted by Alejandro85 View Post
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 System SpecsSystem Spec
.

09 Aug 2014   #4
Alejandro85

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Dayd View Post
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.


Quote   Quote: Originally Posted by Dayd View Post
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 System SpecsSystem Spec
09 Aug 2014   #5
Dayd

7 64 bit
 
 

@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 System SpecsSystem Spec
09 Aug 2014   #6
Dayd

7 64 bit
 
 

Quote   Quote: Originally Posted by Alejandro85 View Post
Quote   Quote: Originally Posted by Dayd View Post
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.


Quote   Quote: Originally Posted by Dayd View Post
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 System SpecsSystem Spec
09 Aug 2014   #7
Alejandro85

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Dayd View Post
@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.


Quote   Quote: Originally Posted by Dayd View Post
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 System SpecsSystem Spec
09 Aug 2014   #8
Dayd

7 64 bit
 
 

[QUOTE=Alejandro85;2850683]
Quote   Quote: Originally Posted by Dayd View Post
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 System SpecsSystem Spec
09 Aug 2014   #9
Ztruker

Windows 10 Pro X64
 
 

Quote   Quote: Originally Posted by Dayd View Post
@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 System SpecsSystem Spec
10 Aug 2014   #10
Dayd

7 64 bit
 
 

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 Images
batch file question-sysres.jpg 
My System SpecsSystem Spec
Reply

 batch file question




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Task Scheduling With Batch File Question
Hi everyone, I've recently been setting up some automation via TS with great success, until now. I want it to delete daily all content, sub folders and files etc from my TV shows parent folder. I am using the following shell script (.cmd batch file) @echo off setlocal...
Performance & Maintenance
Newb, Win 7 Batch file question-KVM switching
hello Sorry if I'm posting this to the wrong place, but I'm not sure what this would be classed under. I would like to be able to change between the two computers connected to my KVM by clicking on an icon. My Belkin KVM has a remote switch that should be on my desktop, but my two cats...
General Discussion
question - batch file only works with "unofficial" directory name
Hello... I'm using a command line batch file to backup files from my W7 Pro x64 machine to an external USB HD. Basically, "xcopy c:\......\my documents\*.*" "external HD". I couldn't get this to work until I truncated the source directory to "documents" instead of "my documents" . While the batch...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Quick batch file question
Hi, I have just created a batch file to backup a few things on my machine, the thing is the batch file has a menu in it and i was wondering if i was to set the batch file to run under task scheduler say once a week is there a way i can get it to excute through the menu of the batch file? if not...
General Discussion


Our Sites

Site Links

About Us

Find 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 01:48.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App