Batch file trick to automatically shutdown windows

  1. Previous
  2. Next
  3. Recent

    1. Signs 'He' May be Cheating on You
    2. 7 Vows of Hindu Marriage - Know What 'Saat Vachans' Mean
    3. RuPay vs Visa vs Mastercard vs American Express- A Comparison
    4. What is RuPay? Everything You Need to Know About India's Domestic Payment System!
    5. Top 10 Online Portals to Find a High Paying Job in India
    6. Top Indians who Revolutionized the IT Sector in India
    7. 8 Initiatives by Narendra Modi that Could Change the Future of the Nation
    8. 8 Work-from-home Jobs for Housewives, Students, and Part timers
    9. Complete Company Registration Process in India - Explained
    10. Change Name in India in 5 Steps - Filing Affidavit, Newspaper Ad & Gazette Notification

We’ve all heard of the utterly useful batch files. Dreaded as they are, some batch file tricks can automate a lot of tasks and in the process, provide some really interesting (or annoying) scares and laughs.

In essence, a batch file offers all that you can achieve with the command line. In addition however, it also allows a couple more features; including the use of variables and the conditional statements (if-else). Here are a few batch file tricks:

Automate Shutdown

The shutdown command when used within a batch file can perform a lot of powerful actions. If you feel shutting down your machine requires more clicks than necessary, you can create  desktop shortcut for the same. Here are the various parameters available:

/s – shutdown
/h – hibernate
/r – restart
/a – abort a shutdown command
/p – shutdown without warnings
/t – specifies the time in seconds after with the machine shuts down. The default time for shutdown is 30 seconds
/m – shuts down a remote computer on the network

Usage:

Write the following line in notepad and save it with name ‘shutdown.bat’. Whenever you open this ‘shutdown.bat’ file, windows will shutdown after 120 seconds.

(Also works when this code is directly entered in Command Prompt/cmd)

shutdown /s /t  120

automatic shutdown using batch file trick

The /m attribute allows you to shut down a machine on the network. This can serve as a clever way for spreading scare on a network. It is to be noted however that the target machine should support remote shutdown. Following code shutsdown a windows system(86.87.124.1) in network after 120 seconds.

shutdown /s /t 120 /m 86.87.124.1

To abort shutdown, use the following code and save it as ‘abort.bat’. But this code must be executed within time(120secs).

shutdown /a

For this batch file trick, it is advisable to make two shortcuts one each for shutting down and for aborting an accidental command.

To check if its working fine, open your ‘shutdown.bat’ file and once countdown for shutdown starts, run ‘abort.bat’. Shutdown would stop.

Make a harmless virus for automatic shutdown

The commands given below create a small, harmless virus that forces the shutdown of the machine. The commands develop an infinite loop. The only way to stop the unfolding windows is to either find out the parent window and close it, or restart the machine.

:start
start name.bat
go to start

Here ‘name.bat’ is the name of the file you save these commands in(again, as ‘shutdown.bat’).

This simple loop opens the file and keeps repeating the operation due to the ‘go to start’. line.

And here is one cool batch file trick,

Run CMD and Regedit when blocked

If your administrator has blocked CMD and/or the Registry, here’s a way to circumvent it.

  1. Open notepad and enter ‘COMMAND.COM'(for CMD) or ‘Start regedit'(for Registry)
  2. Save the file as ‘anything.bat’ (without the quotes)
blog comments powered by Disqus