Friday, February 6, 2015

Reboot for Windows - Linux Alternative

Windows Reboot V1.0

A lot of us who use both Windows and Linux find Windows cli commands lacking at times. Linux is best ran by the command (terminal) line in my opinion and almost everything you can do on a computer in Linux can and should be done via the terminal. One of the most annoying things I have found in Windows is the horrible way you have to reboot your computer from Windows CMD. In Linux it's as simple as typing 'reboot'.

In Windows in order to reboot your computer from a command line you must type 'shutdown /r /t 0' to reboot your computer. While this comes in handy for some things it is annoying for normal every day usage. I have created a batch to exe (for portability and easy use with administrative priveledges) script to emulate this feature in Windows. Simply place the reboot.exe in your C:\Windows\System32\ or any path in Windows %PATH% variable and run from command line with 'reboot'.

The difference between Linuxs 'reboot' and my Windows version is that an amount of time to wait before reboot can be passed to it as you would any passed parameter:
reboot 30
will wait 30 seconds before the reboot.

This is available in 3 versions; the original cmd script, reboot with admin manifest and a reboot without admin manifest (rename to reboot) for use on public computers:

Orignal script:

@echo off

if [%1]==[] (
call :restart
) else (
set rt=%1
call :passed

goto :eof

shutdown /r /t %rt%
exit /b

shutdown /r /t 0
exit /b

No comments: