Reboot Windows computer from command line (CMD)
We can reboot a Windows computer from command line using the in-built shutdown command. Below you can find syntax of this command for various use cases. The below commands work on Windows 7, Windows 8, Windows 10 and all other server editions.
Command to reboot windows computer
The above command will set a time out of 30 seconds to close the applications. After 30 seconds, windows reboot will start.
If you want to reboot Windows with your own time out value you can use the below command.
To shutdown a Windows computer
To abort computer reboot
If you have issued a reboot command and have changed mind, you can stop Windows reboot by running the below command.
When you run this, you would see a pop up window at the right bottom part of the screen(near system tray) that shows the message “The scheduled shutdown has been cancelled”.
To force reboot by closing applications without warning
Open the shutdown GUI
Add reason for the reboot of the computer
Reboot Windows using WMIC commands:
Reboot windows using WMIC
You can run the below wmic command to reboot Windows OS.
Is the abort command supposed to work if one has issued the reboot from GUI. I have tried this on my Windows 7 Ultimate, it does not seem to be working. it says ‘no shutdown was in progress’
Abort works only when you had issued the reboot/shutdown using the command. GUI actions are not aborted by /a option.
I’ve just attempted all commands from Windows 7 Ultimate install disk (used as recovery disk) and I obviously have a fault with my disk trying to load the Windows installation volume, I’ve launched command prompt via shift F10 as the GUI was not responding or should I say it had a never ending hour glass, trying a force shut down resulted in ‘the function is unknown’ proceeded with some numerical digits inside of closed brackets?
Shutdown /a is very handy when windows update tries to force reboot your computer. You can run this command and cancel the reboot if you don’t want the reboot to happen at that time.
Stop, Start, Restart Windows Service Command Line – How to
Windows Service management through the command line is really a good approach when you want to manage plenty of services and perform day to day actions like stop, start and restart
I think you would agree, If I say GUI is fun for entry-level but when it comes to performing the job smartly and creating automation for efficiency. Command-line is your key
PowerShell has a lot of commands to help us manage the windows server better and create automation and do the boring (or) repetitive tasks swiftly
In this article, we are going to see How to Manage Services from the Windows Command line using PowerShell. We are going to see various examples of How to List , Stop, Start, Restart a Single Service or multiple Services.
To Manage the Services in Windows, We have a pack of Powershell commands and each does a unique job in the Windows Service Management. It helps us perform our day to day needs like Stopping, Starting, Restarting, Listing, Searching, etc
In this article, we are going to see various Windows Powershell commands such as
- Get-Sevice
- Stop-Service
- Start-Service
- Where-Object
- Restart-Service
Not just this, There are few more and look at the index to know what this article is packaged with
I am thrilled and I hope you are too. Let’s march on.
Index
- How to List the Services Windows Command Line
- How to List only Running or Stopped Services in PowerShell
- How to List a Service or Get Service by Name in Windows
- How to Search for the Service[s] by Status, DisplayName, Search String etc.
- How to Stop the Service[s] in Windows Command Line
- How to Start the Service[s] in Windows Command Line
- How to Restart the Service[s] in Windows Command Line
How to List the Services in Windows Command Line
To List, all the Services in your Windows PC or Server, Perform the Following Steps
- Open PowerShell Terminal or PowerShell ISE as Administrator
- Type Get-Service in the Terminal
You would be presented with all the available Services on the Windows Machine
The result would container three columns as shown below, Status, Name, and DisplayName
You can search or List a Single or Multiple Services based on any of these columns, which we will see in upcoming sections on this article.
How to List only Running or Stopped Services in PowerShell
In this section we are going to see how to list the windows services based on a Specific State they are in.
To List, Either only Running and Stopped Services, PowerShell Get-Service Command can be used along with one more Filtering command named Where-Object .
It acts like a grep of Linux and it does the job so perfect and precise
So to List Running or Stopped Services in Windows Command line you should do the following
- Open PowerShell Terminal or PowerShell ISE as Administrator
- Use one of the following command based on your requirement
To List Only The Running Services
To List only the Stopped Services
In fact, You can Use any of the Following State Value in place of Running or Stopped to get the Services in that State.
Value | Meaning |
---|---|
ContinuePending | The service has been paused and is about to continue. |
Paused | The service is paused. |
PausePending | The service is in the process of pausing. |
Running | The service is running. |
StartPending | The service is in the process of starting. |
Stopped | The service is not running. |
StopPending | The service is in the process of stopping. |
For example, If you would like to Get a Service which is in Paused State then your command should be like this
How to List a Service or Get Service by Name in Windows
To List or to Get a Service by Name you have to be aware of the Name of the Service or at least a part of the Service name as we can use * wildcard to find the rest.
To List or to Get Service by Name do the following
- Open PowerShell Terminal or PowerShell ISE as Administrator
- Use the following Get-Service the command along with a -Name (or) -DisplayName parameter
To List a Service named Jenkins I can use any of the following commands and Be informed that Service Name is Case In sensitive
How to Search for the Service[s] by More Filters
Sometimes, Our requirement would not be simpler as we think, It might get complicated when we get a requirement like
We might have to list (or) restart all the tomcat instances running on the server and exclude instance which contains a Specific String in its name
Let’s Suppose, that we have a Windows Server with N number of Tomcat Services (instances) and they are named after their Environment name they belong to like dev, uat etc. like Dev_Tomcat1, Test_Tomcat2, Uat_Tomcat4 and so on.
Now to list only the DEV and UAT instances and not SIT we would have to use some more filters other than just Name or DisplayName
Here are some examples related to this type of scenario.
How to Stop the Service[s] in Windows Command Line
We have so far seen, how to list the services in windows machine (PC or Server) using the Powershell command line.
Now we are going to see, How to Stop the Service[s] in Windows PowerShell Command Line
Now let us Split this Part into two as follows
- How to Stop a Single Service by Name
- How to Stop One or More Services matching the Query (or) Search term
Despite you are stopping a Single Service or Multiple Services. You have to first list the Services with Get-Service with necessary Filters like -Name or Status etc.
Once the result is presented, With the help of pipe | symbol you pass all the services to an another Command called Stop-Service
Stop-Service command is responsible to stop the service (or) Services
Simply put, to Stop the Service or Services. You just need to list it first and make sure thats what you want to be stopped and then redirect it to Stop-Service with the help of pipe
Here are some of Windows Stop Service Example commands
How to Start the Service[s] in Windows Command Line
Now we are going to see, How to Start the Service[s] in Windows PowerShell Command Line
Despite you are Starting a Single Service or Multiple Services. You have to first list the Services with Get-Service with necessary Filters like -Name or Status etc.
Once the result is presented, With the help of pipe | symbol you pass all the services to another Command called Start-Service
Here are some of Windows Start Service from Command Line examples
How to Restart the Service[s] in Windows Command Line
We have just learned how to Stop and Start the services, Now it is a time to learn How to Restart Service from Windows Command Line
To Restart windows Service Command Line do the following
- Open PowerShell Terminal or PowerShell ISE as Administrator
- Use the following Get-Service the command along with a -Name (or) -DisplayName parameter and List the Services you want to be restarted
- In the same Command add a pipe | symbol at the suffix along with a command Restart-Service
To Restart Windows Service from Command Line, First we need to list the services that we want to be restarted using Get-Service we can customize and Search for the Services you want using Get-Service parameters like Name and DisplayName , Status etc
Once we have the list ready with Single or Multiple Services that we want to restart.
We can use another command, Given dedicatedly to restart services named Restart-Service
In most cases, we would like to have more control on the Restart process, in such cases, you can try to Stop and Start the services using Stop-Service and Start-Service commands rather directly using Restart-Service
Here are few examples of How to restart the Service in Windows Command Line
So This is how Windows PowerShell commands help us to manage the Windows services from Command line, We learned how to List, stop, start and restart windows services from command line
With this command line, We can stop, start, restart Multiple services at once in bulk that’s what I like the most about it.
If you have any questions for me. Please feel free to comment
Rate this article [ratings] Share it with your friends if you find it worth
Follow us on Facebook or Twitter For more practical videos and tutorials. Subscribe to our channel Find me on Linkedin My Profile For any Consultation or to hire us hello@gritfy.com If you like this article. Show your Support! Buy me a Coffee.
More from Middleware Inventory
Introduction Like Linux, Windows does have a netstat command and it can come handy when you are in need of network-related monitoring and troubleshooting. Consider you have any of the following requirement How to find who or which process owns the port in Windows Server To see how many HTTP/DB…
The Objective In this post, we are going to see how to Start the Weblogic Admin and managed server in the command line. Presumably, most of the weblogic servers in the industry is running in LINUX Operating System and So this article is designed for the Linux as well. Prerequisite…
The Objective How to solve the situation where the vagrant up command gets stuck while checking if box is up to date . By default when you bring up the virtual machine provisioned with vagrant using vagrant up command.vagrant will look for the updates associated with the box and make…
Ansible Command Module Introduction Ansible Command module is used to execute commands on a remote node. The Command module, is used mostly to run simple Linux commands on a remote node/server which is part of a host group or Stand alone server mentioned in the host group. If you want…
If you are here, Then you might have had a similar requirement I had, which is to find a specific file across multiple directories and to grep or Search for a string present in that file. ( more like what we do with xargs in Linux) I am a Linux…
Windows 7 restart after running «cmd» command from RUN command line
Ideas:Windows 7 restart after running «cmd» command from RUN command line
· Since when are you facing this issue?
· Do you remember making any changes to the system?
· Do you encounter any error message when the system restarts? If yes, what is the exact error message?
Method 1:
I would suggest you to try to run a different command from the Run and check whether the issue occurs.
a. Click on start menu and click on Run.
b. Type ‘devmgmt.msc’ in the run box and check whether the Device manager opens and whether the issue persists.
Method 2:
I would suggest you to open cmd from start menu and check whether you are able to open the command prompt or not.
a. Click on Start menu and type cmd in the start search box and press enter.
b. Check whether the command prompt opens without any issues.
Method 3:
I would suggest you to do a SFC scan. System File Checker (SFC) checks that all Windows 7 system files are where they should be as they were by default and not corrupted, changed, or damaged.
a. Click Start, click All Programs, click Accessories, right-click Command Prompt, and select Run as Administrator.
b. Click Continue or supply Administrator credentials if prompted.
c. In the Command Prompt window type the following, and press Enter:
d. You should see the following on-screen message:
§ Beginning the system scan. This process will take some time.
§ Beginning verification phase of system scan.
e. Verification % complete.
f. Once the scan has completed, test to see whether the issue that you are experiencing is resolved or not.
For further reference, check the KB article mentioned below.
Thank you and Regards.
Thahaseena M
Microsoft Answers Support Engineer.
Visit our Microsoft Answers Feedback Forum and let us know what you think.