TekRevue

  • Home
  • OS X
  • Windows
  • Mobile
  • Games
  • Reviews
  • Editorials
  • Tips
    • Windows
    • Mac
    • Mobile
  • Twitter
  • Facebook
  • Google+
  • Feed

 033

Windows

Quickly Shut Down or Reboot a Remote PC with a Custom Batch File

By Jim Tanous on December 7, 2015 at 4:37 AM • @mggjim

We’ve previously looked at how you can use the shutdown command via the Windows Command Prompt to shut down and reboot remotely connected PCs. Once you understand how the command works, using the shutdown command and its various parameters is relatively quick and easy, but if you frequently connect to the same remote PC, you can save some time by creating your own shut down or reboot batch file. Here’s how.

Don’t wait another day to Level Up Your Life! Join the Nerd Fitness Rebellion and learn how to use your favorite video games, books, and movies as inspiration for adventure rather than an escape from the grind of everyday life.

For those unfamiliar with the concept, batch files (also known as batch programs or scripts) are raw text files that contain one or more command line instructions. A user can create a batch file by typing desired commands in order, and then the computer will execute each command in sequence when the file is run. Batch files can greatly simplify repetitive tasks, allowing users to craft potentially complex command line instructions just once and then repeatedly run the commands as needed with just a click.

There are a multitude of uses for batch files, but we’re focusing today on creating a relatively simple file that will shut down or reboot our remotely connected Windows PC with the desired options and parameters. To get started, first take a minute to review how the shutdown command works, including its primary parameters.

Next, while connected to the remote PC, create a new blank text document in Notepad (note: you can create your shutdown or reboot batch file on any computer and then manually transfer it to the remote PC, but creating it directly on the remote PC saves a step).

With your blank Notepad document open, craft your reboot or shut down command. In our example, we want our batch file to reboot our remote PC, force all open applications to close, and reboot immediately without a time delay. Based on the appropriate command parameters for the shutdown command, we’ll therefore type the following into our Notepad document:

shutdown -r -f -t 0

To recap, the shutdown command is used for both shutting down a PC and rebooting it based on the correct parameter. In this case, using -r tells the command that we want to reboot. The -f parameter tells the command to force-close any running applications, which prevents any errors or programs from unintentionally preventing our remote PC from executing the reboot command. Finally, the -t parameter instructs the command to perform the reboot with a zero-second (0) delay.

You can customize the shutdown command as you desire, such as having the command actually shut down the remote PC instead of rebooting it (-s instead of -r), add a time delay, display a custom message before shutting down, and more. You can also combine shutdown commands along with specific computer names or addresses to reboot or shut down multiple PCs at once.

save remote reboot batch file

When you’re done crafting your shutdown command, go to File > Save and navigate to a convenient location for your batch file. Next, select the Save as type drop-down menu and select All Files. Finally, give your batch file a name in the File name box, and end it with a .bat extension. In our example, we’ll name our batch file Remote Reboot.bat and place it on the desktop of our remote PC.

You can now close Notepad and, if you’re ready, test the batch file by double-clicking on it to execute it. If the shutdown command was formatted correctly, you’ll see your remote PC reboot or shutdown with the designated parameters and options. Once you’ve verified that your batch file works as intended, you can duplicate and modify the command as needed for additional remote PCs.

Also note that we’re using a batch file to automate the shutdown command in the context of a remote PC, but this command and the batch file itself will work on any Windows PC on which it is executed (or any network PC designated by the -m parameter), including your local PC. This article also focused on executing the batch file via a remote desktop GUI, but you can also launch a batch file via the command line.

Want news and tips from TekRevue delivered directly to your inbox? Sign up for the TekRevue Weekly Digest using the box below. Get tips, reviews, news, and giveaways reserved exclusively for subscribers.

 033

  • Categories: Windows
  • Tags: #Batch Files #Command Prompt #How To #Notepad #Remote Desktop #Tips #Windows

Sign Up for the TekRevue Weekly Digest

Read more in Windows on TekRevue

  • windows lock screen wallpaper
    How to Find Windows Spotlight Lock Screen Images in Windows 10

    Filed Under: Windows

  • cpu processor glow
    How to Restrict Apps to Specific CPU Cores with Processor Affinity

    Filed Under: Windows

  • remove recycle bin windows 10 desktop
    How to Remove Recycle Bin from the Windows 10 Desktop

    Filed Under: Windows

  • http://www.team-soporte.es.tl/ Jeremy Molina

    I dont know if is me, but the command itself works to shut-down/reboot local computer because you are running the command over the same computer, you must clear which is the full command and how to set-it up to makes a remote(Other computer connected to the same LAN) shut-down or reboot.

    I copy from Microsoft Web-Site which is the full command you must set-it up to makes a remote, network connected computer shut-down:

    Examples

    To shut down \MyServer in 60 seconds, force running applications to close, restart the computer after shutdown, indicate a user code, indicate that the shutdown is planned, log major reason code 125, and log minor reason code 1, type:

    shutdown -r -f -m \MyServer -t 60 -d up:125:1

    Here is the source: https://technet.microsoft.com/en-us/library/bb491003.aspx?f=255&MSPPError=-2147217396

Search

Related Articles

  • windows 10 start menu run command
    How to Add the Run Command to the Windows 10 Start Menu
  • pc-power-button
    How to Shut Down and Reboot Remote PCs via the Command Prompt
  • Command Prompt
    Quickly Launch Command Prompt as an Administrator with a Keyboard Shortcut

Connect with TekRevue

  • TekRevue on Twitter
  • TekRevue on Facebook
  • TekRevue on Google+
  • Cheats
  • Deals
  • Distractions
  • Editorials
  • Gadgets
  • Games
  • Giveaway
  • Hardware
  • Mobile
  • News
  • OS X
  • Podcast
  • Reviews
  • Sponsor
  • Tips
  • More in Windows
  • windows lock screen wallpaper
    How to Find Windows Spotlight Lock Screen Images in Windows 10
  • cpu processor glow
    How to Restrict Apps to Specific CPU Cores with Processor Affinity
  • remove recycle bin windows 10 desktop
    How to Remove Recycle Bin from the Windows 10 Desktop
  • windows 10 nametag
    How to Rename Your PC in Windows 10
  • reboot pc
    Quickly Shut Down or Reboot a Remote PC with a Custom Batch File
  • windows-10-build-number
    Quick Tip: How to Find Your Windows 10 Build Number
  • windows 10 display scaling
    How to Manage 4K Display Scaling in Windows 10
  • windows 10 start menu run command
    How to Add the Run Command to the Windows 10 Start Menu
  • surface windows 10 screensavers
    How to Use and Configure a Screensaver in Windows 10
  • windows 10 mail
    How to Change or Remove the Windows 10 Mail Background Image
  • windows pc question mark
    How to Identify Unknown Startup Programs in the Windows Task Manager
  • file explorer windows 10
    Why and How to Delete the Windows.old Folder in Windows 10
  • edge start page google
    How to Start Edge with Google or Any Custom Start Page
  • broken-clock
    How to Remove the Clock from the Windows 10 Taskbar
  • remove-onedrive-file-explorer-windows-10
    How to Remove OneDrive from the File Explorer Sidebar in Windows 10
  • ms paint icon windows
    How to Use the Windows Right-Click ‘Edit’ to Launch Photoshop Instead of MS Paint
  • windows start menu evolution
    The Evolution of the Windows Start Menu: Windows 95 to Windows 10
  • small start menu windows 10
    How to Remove Live Tiles and Get a Smaller Windows 10 Start Menu
  • windows 10 clean install
    The Key to a Successful Windows 10 Clean Install is to Upgrade First
  • cortana-windows-10
    How to Shrink or Hide the Cortana Search Bar in Windows 10

Tips

  • Apps
  • Gaming
  • Mac
  • Mobile
  • Online
  • Windows
  • office 365 installer
    How to Install the Older Office 2013 via Office 365
  • itunes 12 separate download window
    iTunes 12: How to Show a Separate iTunes Downloads Window
  • remove creative cloud files file explorer
    How to Remove Creative Cloud Files from the File Explorer Sidebar in Windows
  • chrome offline installer
    How to Download the Chrome Offline Installer
  • steam trash
    How to Remove a Game From Your Steam Library
  • xbox one elite controller
    How to Use Custom Button Mapping on the Xbox One
  • xbox one 60fps 1080p windows 10 streaming
    How to Use 1080p/60fps Xbox One Streaming in Windows 10
  • gta 5 custom music
    How to Use Custom Music and the Self Radio Station in Grand Theft Auto V
  • gatekeeper el capitan
    How to Permanently Disable Gatekeeper in OS X El Capitan
  • el capitan transparency
    How to Reduce Transparency in OS X El Capitan
  • replace login screen wallpaper os x el capitan
    How to Replace the OS X El Capitan Login Screen Wallpaper
  • Mac OS X Dock
    How to Dim Hidden Mac App Icons in the Dock
  • apple tv siri remote
    How to Check the Siri Remote Battery Life on the Apple TV
  • new-apple-tv-home-screen
    How to Move and Delete Apple TV Apps
  • record 4k iphone 6s
    How to Record 4K Video on the iPhone 6s
  • view desktop site safari ios 9
    How to Easily View the Desktop Version of a Website in iOS 9 Safari
  • netflix bandwidth data usage
    How to Reduce Netflix Bandwidth Usage to Avoid ISP Data Caps
  • netflix autoplay
    How to Stop Netflix From Automatically Playing the Next Episode
  • distracted man computer
    How to Turn Off Distraction-Free Mode in WordPress
  • watch super bowl online
    Attention Cord-Cutters: How to Watch the Super Bowl Online
  • windows lock screen wallpaper
    How to Find Windows Spotlight Lock Screen Images in Windows 10
  • cpu processor glow
    How to Restrict Apps to Specific CPU Cores with Processor Affinity
  • remove recycle bin windows 10 desktop
    How to Remove Recycle Bin from the Windows 10 Desktop
  • windows 10 nametag
    How to Rename Your PC in Windows 10
Company
  • About TekRevue
  • Get in Touch
  • Sponsorships

Sign Up for the TekRevue Weekly Digest

© TekRevue LLC. All Rights Reserved.

  • TekRevue User Agreement
  • TekRevue Privacy Policy

Built by Blazer Six