Without physical access to their computer, most people find it difficult operate it remotely. This may seem like a daunting task but setting up specific programs to run system tasks remotely can be accomplished quite easily. You can open a program, run system checks, or do anything that’s useful while you’re away by sending a simple email to your computer.

This is different from regular scheduled tasks because you’re forcing the schedule to start at will, under the command of your email.

While this may look tough at first glance, rest assured the instructions are laid out plainly. Each command can be altered in your own unique way, but for most people you should be able to download the file and use it as is. After downloading or creating your own, the file will needs to be set up in Outlook to run, when a certain email is sent to the computer. This is customizable and will be nearly the same process for each command.

Please note that MS Outlook is required to run these tasks.

Part 1: Controlling Your PC Remotely via email

In the first part of this guide, we show you how to create files that will execute automatically and run any specified program when you send an email. In the 2nd part of this tutorial we will look at how to setup Outlook to follow these commands when it receives a email.

Run an Automatic Cleanup With CCleaner

CCleaner has a list of command-line parameters here that can be built into a batch file for automated actions. A most notable one runs the program silently, using the default settings with which it was run recently, and then exits on its own.

Commands: This will depend on the type of install: 64-bit or 32-bit. The point is to enter the location of the file with the correct switch. 32-bit versions will be “…\Program Files (x86)\…” and “CCleaner.exe.”

This is the command to use:

pushd “C:\Program Files\CCleaner”
CCleaner64.exe /AUTO

Creating the file: Enter the above command into notepad and save as “CCleanerAuto.bat,” under the “All Files” extension type.


Download This File

Run an Automatic Cleanup With Disk Cleanup

Don’t have CCleaner installed but are still wanting to speed up Windows? The built-in Disk Cleanup utility can be run instead.

Commands: The “1” in this switch is a time to start the cleanup. Choose from 1-65535.

cleanmgr /SAGERUN:1

Creating the file: Enter the above commands into notepad and save as “DiskCleanupAuto.bat,” under the “All Files” extension type.


Download This File

Lock the Workstation

No worries if you forget to lock your computer when you leave. Set up this file to run and it auto-locks the logged on account.


C:\Windows\System32\rundll32.exe user32.dll,LockWorkStation

Creating the file: Enter the above commands into notepad and save as “LockWorkstation.bat,” under the “All Files” extension type.


Download This File

Restart the Print Spooler Service

If printing remotely from a computer/server that hosts centralized printers, restarting the print spooler service may be required to correct issues. Instead of going to the physical machine, consider setting up a file that will do it for you.

Commands: This will stop the service, count down from three, and start it once more.

Note: This can be modified to restart any installed service.

net stop “print spooler”
echo 3
ping -n 2>nul
echo 2
ping -n 2>nul
echo 1
ping -n 2>nul
net start “print spooler”

Creating the file: Enter the above commands into notepad and save as “FixPrintSpooler.bat,” under the “All Files” extension type.


Download This File

Hibernate the Computer

Forgetting to shut down a computer after you’ve left can pose a security risk and use up unneeded power. Shut it down at your leisure with a simple email.

Commands: The below is for hibernation but it can be altered to log off (“/L”) or shutdown automatically (“/s”).

shutdown /h

Creating the file: Enter the above commands into notepad and save as “Hibernate.bat,” under the “All Files” extension type.


Download This File

Launch TeamViewer

I’ve been away from my computer, wanting to log in remotely, only to realize TeamViewer has been shutdown. Restore the program, or any program, with an email by first making this script.

Command: This is for version 8, but ensure the program location (after “pushd”) is correct in your own file.

pushd “C:\Program Files (x86)\TeamViewer\Version8\”
start TeamViewer.exe

Creating the file: Enter the above commands into notepad and save as “Start TeamViewer.bat,” under the “All Files” extension type.


Download This File

While these files work as standalone programs, they need to be linked with an Outlook rule to be ran when met with certain conditions. For example, when an email arrives in your Inbox that says “defragnow,” it will run the defrag operation we just covered. These are all customizable, as we see below.

Part 2: Setting Up Outlook to Run the File on an Email Event

Now that we have a basic idea about the things we can do using email commands, it’s time to set up Outlook, so that it executes any of the above processes when it receives an email. The following process will be same for every one of the above commands.You just need set it up individually for each action you want to perform.

Note: The only things that need to be changed are the “specific words” and “application” conditions.

In Outlook, open “File > Manage Rules & Alerts.”


If multiple accounts are hooked into Outlook, choose the desired one from the “E-mail Rules” tab and click “New Rule.”


In the “Rules Wizard” window, select “Apply rule on messages I receive,” then proceed to the next screen and choose the first three conditions. They will populate in the bottom pane for step 2.


  • Click “specified” and choose an email account that’s connected through Outlook. If only one exists, just select that one. This is to ensure emails sent to other accounts aren’t affected.
  • Click “people or public group” and enter a contact or manual address that should be used as the sender. This ensures emails from only that address/group can launch the program.
  • Click “specific words” and choose a unique set of words to be used as the ‘trigger’. Find something unique that will unlikely be used in regular, everyday conversation to avoid accidental launch. This is not case-sensitive

The end result should look something like this, which will run through my email address if sent only from me with the word AutoClean in the subject.


Continue the wizard to select “start application” in the next screen. Click the word “Application” in the bottom window to browse and find the file that should run. Finish out of the wizard to save the changes with “Apply” back at the Rules and Alerts window.

Keep Outlook Running

Prevent Outlook from shutting down to ensure these tasks will always be performed upon their corresponding incoming messages. To do this, we’ll need to make what’s called an IF ELSE statement. This will check that Outlook.exe is running.

There are times when a program encounters an error or there isn’t enough memory to keep it running and it crashes. Setting up the IF ELSE command in the Task Scheduler will make sure Outlook is always running on your system. So if it’s shutdown due to some error, this command will promptly launch it back.

Running Outlook is required for the emails to actually open the programs, hence the need for this step.


tasklist /FI “IMAGENAME eq OUTLOOK.exe” 2>NUL | find /I /N “OUTLOOK.exe”>NUL
if “%ERRORLEVEL%”==”0” goto 1
if “%ERRORLEVEL%”==”1” goto 2
start OUTLOOK.exe

Creating the file: Enter the above commands into notepad and save as “RunOutlook.bat,” under the “All Files” extension type.


Download This File

Scheduling the file: Create a new task in Task Scheduler under any name that runs on a “Daily” schedule, repeating every “5 minutes.” This ensures that even if Outlook isn’t running, it will only be down for five minutes.


Make a new action to “Start a program” and use the “RunOutlook.bat” as the source file.


Controlling your PC remotely can be a pain in the neck, but having such an option available can be quite useful. Honestly, it’s very convenient if you can clean your office or home PC or defragment it remotely, just by sending an email.

You can always use a remote support software like Team Viewer, but you will actually need to sit in front of your PC to get your work done. By following this method, you can just send an email from your phone or tablet and the task you need to get done will be executed without the need of your supervision.

Alter these files as you need or make brand new ones. Let us know if you come up with a great program that would be useful while away from the computer. Share your tips in the comments and we will try to include it in our list.