How to Run Custom Tasks in Windows 10 with Cortana

Detailed guide to enable Cortana do custom tasks in Windows 10 through some simple steps.

I enjoy speaking commands to Cortana on my Windows PC. However, there are certain tasks Cortana cannot do. And so, I went on to find a way to do more with Cortana without waiting for Microsoft to add more commands.

My goal was to extend the functionality of Cortana and fortunately, it allows to call or run any script or program installed on the computer, so that means I can create a batch or shell script or create my own program to do almost anything. Alright, let’s get on with it.

“Hey Cortana, open…”

I usually say “Hey Cortana, open Chrome” to open Google Chrome, and this is the same command that came to my rescue in this situation. I figured out it can not just open system tools (like Task Scheduler) or installed programs (like Google Chrome), but can run any shortcut present in the Start menu.

That means, such a shortcut can point to any program or script — even custom ones.

How to create custom shortcut in Start menu

As any shortcut in the Start menu can be executed by Cortana, so here’s how you can create it:

  1. Press Win + R keys to open the Run window.
  2. Type shell:programs in the window, then click OK.
  3. Open Run window
  4. File Explorer will open showing “Start Menu > Programs” folder.
  5. Right-click on an empty area > choose New and select Shortcut.
  6. Choose New > Shortcut”/></figure>
<li>A <strong>Create Shortcut</strong> window will show up where you need to give details.</li>
<li>In ‘Type the location of the item’ textbox, you need to <strong>enter a command or the path</strong> of a program or script you wish to run. You can also click the <strong>Browse</strong> button and choose the program or script file interactively.</li>
<figure><img loading=
  7. When you are done entering the path, just click the Next button.
  8. Now you need to give a name to your shortcut. I will suggest to keep it meaningful and speakable because this will be the command you must say to Cortana to run your custom task. For example, if I give ‘Sesame’ as the name of my shortcut, then I need to say “Hey Cortana, open Sesame“.
Enter name for the shortcut
How to place custom shortcut in Start menu

We can also place a shortcut in Start menu, if we already have one. Although this method does not work for commands but we can create shortcuts for programs or scripts easy way and then place that shortcut in the Start menu.

Follow the below steps to quick-create as well as place a shortcut:

  1. Right-click any program or script you wish to create shortcut for.
  2. You will see the context menu > choose ‘Create shortcut‘ option.
  3. Create shortcut of program or script
  4. Now you will see a new shortcut along with the program or script.
  5. Right-click the shortcut, choose ‘Rename‘ from the option list.
  6. Rename the shortcut file
  7. Type in a purposeful and speakable name for the shortcut. This will be the name you will use to tell Cortana to execute it. For example, if you name it ‘Secret’, then you must say “Hey Cortana, open Secret” to run it.
  8. Now press the Win + R keys and you will see the Run window.
  9. Enter shell:programs in the window and click the OK button.
  10. Type in Run window
  11. You will see the File Explorer with “Start Menu > Programs” folder.
  12. Now cut the shortcut created in step #2 and paste it in this folder.
Paste shortcut in Programs

Custom Tasks

Run a command / program

If you wish to run a command or a command-line program (say CCleaner) by just speaking to Cortana, then you can use this method. Follow the aforementioned steps under ‘Create a shortcut in Start menu’ and while doing its step #6, enter the full command in the ‘Type the location of the item’ field.

For example, if you need to create a shortcut to hibernate your computer, then you need to give the following command shutdown /h in step #6. Also, if you name the shortcut as “hibernate me”, then whenever you need to hibernate, you can just speak “Hey Cortana, open hibernate me” to Cortana.

Create shortcut to hibernate

Moreover, let’s say you need to clean your computer using CCleaner, then you can use its command-line options to ease the cleaning process. You only need to replace the command in the above example to "C:\Program Files\CCleaner\CCleaner.exe" /AUTO (it works only if CCleaner is installed in that location) and name it “autoclean me”, then just say “Hey Cortana, open autoclean me” to clean your system using this maintenance tool.

How to Deep-clean Your PC with CCleaner

How to Deep-clean Your PC with CCleaner

Like every other machine, your PC needs cleaning and maintenance. However, in the flow of daily life, we... Read more

Run a batch script

A batch script is a file with multiple commands that get executed by Windows Command Prompt. If you wish to run multiple commands, then you must create a batch script file (with .bat extension). For that, follow the steps in ‘Place a shortcut in Start menu’ tutorial from above to place that file’s shortcut in Start menu.

Run a Bash shell script

A shell script is a file with multiple commands, like a batch script. Although a shell script (with .sh extension) is known to run on Linux/Unix distributions but with the arrival of Bash on Ubuntu in Windows 10, fortunately, it is now possible to run shell commands or scripts directly on Windows as well. In fact, it is one of my favorite features of Windows 10.

Unlike batch scripts, shell scripts do not execute directly by just opening, so we cannot use the same method as with batch script. After you create a shell script, follow the steps under ‘Create a shortcut in Start menu’ and under its step #6, enter this command bash '/mnt/SCRIPT-PATH'.

Create shortcut to run shell script

In place of SCRIPT-PATH, you must enter the script’s path in Linux/Unix style. For example, a file named ‘my_script.sh’ on my desktop has the following path in this style: /mnt/c/Users/aksinghnet/Desktop/my_script.sh.

Run a PowerShell command

PowerShell is the new, more powerful shell than Command Prompt in Windows. It brings in a lot more commands and scripting functionalities than the older prompt, and thus, it can help you do a lot more things in your system.

In order to create a shortcut for a PowerShell command, you must use the steps given above under ‘Run a command or program’. Again, in the step #6, you must enter the PowerShell command that you want to execute.

Create shortcut to run PowerShell command

Moreover, you must write your command in following format: PowerShell -Command "& { COMMAND-HERE }". For example, if you wish to disconnect and then again connect the Wi-Fi to a network named “FastWifi”, then you must use the command PowerShell -Command "& { netsh wlan disconnect ; netsh wlan connect name=FastWifi }" while creating a shortcut.

Run a PowerShell script

PowerShell can also run scripts (with .ps1 extension) having a bunch of its commands. It is more helpful for automating a handful of tasks (even complex ones) and I find it has more powerful scripting than batch scripts.

If you need to create a shortcut for running a PowerShell script, then you have to follow the same procedure as given above under ‘Run a PowerShell command’ but you must keep the command in format: PowerShell -File FILE-PATH. For example, if file is “C:\pscript.ps1”, then use PowerShell -File C:\pscript.ps1.

Create shortcut to run a PowerShell script
20 Windows PowerShell Commands You Must Know

20 Windows PowerShell Commands You Must Know

A list of useful and simple Windows PowerShell commands to help you achieve tasks like getting help or... Read more

Troubleshooting

Cortana cannot find or run my custom shortcut.

First of all, please check that your shortcut is available in the Start menu. You can just look for it under the ‘Recently added’ list in the Start menu.

Find your shortcut in Start menu

Secondly, please check you are not naming it upon a standard command or name like computer, sleep, shutdown, etc. If you are, just press Win + R keys, type in shell:programs and press Enter, then find your shortcut in the File Explorer and rename it to something else — meaningful but some custom name.

WebsiteFacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenWhatsappEmail