How to Run Any Command Prompt Command with Cortana

Cortana may not be as popular as Microsoft was hoping for, but it can be useful. No longer do you need to be next to your computer to perform a task; you can shout it from the other side of the room. However, there are some things Cortana can’t do out of the box.

Thanks to Windows 10’s Fall Creators Update, for example, Cortana can now shut down, restart, lock, or sign you out of your PC. Just say “Hey Cortana, shut down my PC”—it’s that simple. It can’t, however, put your PC to sleep, which is the one thing I really would like to do with my voice.

There’s an easy workaround for this, though. Cortana can open any program it finds in the Start Menu with a simple voice command. So if you can make a shortcut out of the task you want to perform—such as a Command Prompt command—Cortana can do it with your voice.

To do this, open File Explorer and paste the following path in the address bar:

%APPDATA%\Microsoft\Windows\Start Menu\Programs

This will open up your Start Menu’s list of programs (which is where Cortana looks for shortcuts when you say a command). Right-click an empty area inside this folder and select New > Shortcut.

In the location box, type the Command Prompt command you want to invoke with your voice. In my case, I want to put my PC to sleep—the command for which is:

rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Obviously, replace this with whatever command you want to use. Click Next.

On the next screen, name your shortcut whatever you want. In my case, I’m going to name it “Sleep Computer”.

Click Finish when you’re done. You should see your new shortcut in the Programs folder.

That’s all it takes! Now you just need to invoke that shortcut by saying “Hey Cortana, Open [Shortcut Name].” In my case, I’d say “Hey Cortana, Open Sleep Computer”.

It’s not the most natural language in the world, but hey—for a geeky workaround, it’s not bad at all.

Whitson Gordon is is the editor-in-chief of How-To Geek. He is also a Windows user, PC builder, metalhead, chopstick-using potato chip eater, and Midwest-to-Southern California transplant. You can follow his nerdy exploits on Twitter and Facebook.