Difference between revisions of "Cmd tools"

From TheBestLinux.com
Jump to navigation Jump to search
Line 15: Line 15:
 
<br />
 
<br />
 
So, to see how long your Windows computer has been turned on for since it was last turned off or rebooted, type this from the command prompt:
 
So, to see how long your Windows computer has been turned on for since it was last turned off or rebooted, type this from the command prompt:
<pre style="color:blue">net statistics server</pre>
+
<pre style="color:blue">C:\net statistics server</pre>
 
and hit the "ENTER" key.
 
and hit the "ENTER" key.
 
You will get an output similar to this:
 
You will get an output similar to this:

Revision as of 21:02, 2 November 2015

All of these commands must be run from a command line prompt or window, what used to be called the DOS prompt!


If you don't know how to open a command prompt in Windows, it's very easy. Just click on the Start button, usually at the very bottom left corner of your computer screen, and then right above where you clicked where it says "Search programs and files", type "cmd" without the quotes and hit the "ENTER" key on your keyboard. It will then open up a command prompt window, where you can type many powerful commands using your keyboard and hitting the "ENTER" key when done to tell the computer you are done typing the command you want it to run, so now do it!

Here are some very useful command line commands you can type to get information you otherwise may not be able to do from a normal Windows program


To find out when the OS(Opertaing System) was install, which can be a good way to find the age of the computer. This is the command:

C:\>systeminfo | findstr Original



To see how long a Windows computer has been turned on for since the last time it was turned off or rebooted, there is no UNIX/Linux equivalent of the command "uptime", which shows you exactly how long the machine has been "Up" or turned on for. A command to get that same information is a subset of the "net" family of command line commands.
So, to see how long your Windows computer has been turned on for since it was last turned off or rebooted, type this from the command prompt:

C:\net statistics server

and hit the "ENTER" key. You will get an output similar to this:

Server Statistics for \\COMPUTER_NAME


Statistics since 9/27/2015 4:55:18 PM


Sessions accepted                  1
Sessions timed-out                 0
Sessions errored-out               328

Kilobytes sent                     925
Kilobytes received                 4351

Mean response time (msec)          0

System errors                      0
Permission violations              0
Password violations                4

Files accessed                     0
Communication devices accessed     0
Print jobs spooled                 0

Times buffers exhausted

  Big buffers                      0
  Request buffers                  0

The command completed successfully.



You can shorten the command as well, like this:

net stats srv



Also, you can filter out all of the extra data and information provided by the output of this command by piping the output of the command into the findstr command to only display the one line we are looking for, that starts with "Statistics since...", like this:

net stats srv | findstr "since"


Which produces an output similar to this:

Statistics since 9/27/2015 4:55:18 PM


This gives you exactly what you are looking for, as the date and time indicates when the computer was powered on since it's been currently running.

To reboot your computer from the command line, which is the only way to do it if you are connected to it remotely instead of directly, such as when using Windows Remote Desktop, which I have to do multiple times at the same time on many multiple Windows servers while I am at work. From a command line window, type this to reboot the computer in 30 seconds:

shutdown /r /t 30

and hit the "ENTER" key to compete the command. If you've typed the command correctly, instead of receiving an error message, a pop-up window should pop up stating that the computer is going down for a reboot in 30 seconds.

More command line info to come as I have time. Thanks for checking this and all of my other Wiki tips, tricks, and helpful information about all things computers!