This blog is about the How to Run Custom Tasks with Cortana on Windows 10 PC. We will try our best so that you understand this guide . I hope you guys like this blog, How to Run Custom Tasks with Cortana on Windows 10 PC. If your answer is yes after reading the article, please share this article with your friends and family to support us.
Check How to Run Custom Tasks with Cortana on Windows 10 PC
I enjoy speaking commands to Cortana on my Windows PC, however there are certain tasks Cortana can’t do. And so I kept looking for 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 allows call or run any script or program installed on the computer, which means I can create a batch or shell script or create my own program to do just about anything. All right, let’s move on.
“Hello Cortana, open …”
I usually say “Hello Cortana, open Chrome” to open Google Chrome, and this is the same command that came to my rescue in this situation. I found that not only can you open system tools (like Task Scheduler) or installed programs (like Google Chrome), but you can run any shortcut present in the Start menu.
That means that such a shortcut can point to any program or script, even custom ones.
How to create a custom shortcut on the Start menu
Since Cortana can run any shortcut on the Start menu, here’s how you can create it:
- Press the Win + R keys to open the Run window.
- Type shell: programs in the window, then click okay.
- File Explorer will open showing “Start Menu> Programs” binder.
- Right click on an empty area > choose New and select Shortcut.
- When you are done entering the route, simply click on the next button.
- Now you need give your shortcut a name. I’ll suggest keeping it meaningful and spoken because this will be the command you need to tell 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”.
How to put a custom shortcut on the Start menu
We can also place a shortcut in the Start menu, if we already have one. Although this method does not work for commands, we can create shortcuts for programs or scripts easily and then put that shortcut in the Start menu.
Follow the steps below to quickly create and place a shortcut:
- Right click on any program or script for which you want to create a shortcut.
- You will see the context menu > choose ‘Create shortcut‘option.
- You will now see a new shortcut along with the program or script.
- Right click on the shortcut, choose ‘Rename‘from the list of options.
- Write a purpose and spoken name for the shortcut. This will be the name you will use to tell Cortana to run it. For example, if you name it ‘Secret’ then it should say “Hello Cortana, open Secret” to run it.
- Now press Win + R keys and you will see the Run window.
- Enter shell: programs in the window and click on the okay button.
- You will see File Explorer with the “Start Menu> Programs” folder.
- Now cut the shortcut created in step 2 and paste it into this folder.
Custom Tasks
Execute a command / program
If you want to run a command or command line program (eg CCleaner) just by talking to Cortana, you can use this method. Follow the steps mentioned above in ‘Create a shortcut on the Start menu’ and while doing step # 6, enter the full command in the ‘Enter the location of the item’ field.
For example, if you need to create a shortcut to hibernate your computer, then you should give the following shutdown / h command in step # 6. Also, if you name the shortcut as “hibernate me”, whenever you need to hibernate, you can just say ” Hello Cortana, open up hibernate me“To Cortana.
Also, let’s say you need to clean your computer using CCleaner, then you can use its command line options to make the cleaning process easier. You only need replace command in the above example to “C: Program FilesCCleanerCCleaner.exe” / AUTO (works only if CCleaner is installed in that location) and name it “autoclean me”, then say “Hey Cortana, open self clean”To clean your system with this maintenance tool.
Run a batch script
A batch script is a file with multiple commands They are run through the Windows command prompt. If you want to run multiple commands, you must create a batch script file (with the extension .bat). For that, follow the steps in ‘Put a shortcut in the Start menu’ tutorial above to place the shortcut for that file in the 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 to Ubuntu on Windows 10, thankfully now it is possible to run shell commands or scripts directly in Windows also. In fact, it’s one of my favorite Windows 10 features.
Unlike batch scripts, shell scripts are not directly executed just by opening them, so we cannot use the same method as with batch scripts. After creating a shell script, follow the steps in ‘Create a shortcut on the Start menu’ and under your step # 6, enter this command bash ‘/ mnt / SCRIPT-PATH’.
Instead of SCRIPT-PATH, you must enter the Linux / Unix style script path. 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 shell more powerful than the command prompt in Windows. Contributes a lot more commands and scripting features than the previous indicator and thus it can help you to do a lot more things on your system.
To create a shortcut for a PowerShell command, you must follow the steps above in ‘Run a command or program’. Again, in step n. 6, must enter the PowerShell command you want to run.
Also, you must write your command in the following format: PowerShell -Command “& {COMMAND-HERE}”. For example, if you want to disconnect and then reconnect Wi-Fi to a network called “FastWifi”, then you should use the PowerShell -Command “& {netsh wlan disconnect; netsh wlan connect name = FastWifi} ”while creating a shortcut.
Run a PowerShell script
PowerShell can also run scripts (with a .ps1 extension) with various of its commands. It is most useful for automating a handful of tasks (even the most complex ones) and I find that it has more powerful scripts than batch scripts.
If you need to create a shortcut to run a PowerShell script, then you should follow the same procedure as above in ‘Run a PowerShell command’ but you should keep the command in format: PowerShell -File FILE-PATH. For example, if the file is “C: pscript.ps1”, use PowerShell -File C: pscript.ps1.
Problem solving
Cortana can’t find or run my custom shortcut.
First of all please check that your shortcut is available in the Start menu. You can find it in the ‘Recently Added’ list in the Start menu.
Second, check that you are not naming it in a standard command or name like computer, sleep, shutdown, etc. If so, just hit Win + R keys, type shell: programs and hit Pay in, then find your shortcut in File Explorer and rename it to something else, meaningful but with a custom name.
Final remarks: How to Run Custom Tasks with Cortana on Windows 10 PC
I hope you understand this article, How to Run Custom Tasks with Cortana on Windows 10 PC. If your answer is no, you can ask anything via the contact forum section related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.