How do I Run command prompt from registry?

This is technically possible, but is probably not the best way to do this.

How

In order to run multiple commands, they need to be "single line" commands. The sequence of commands must be able to run in one line in the command prompt. That means they need to be contained within the quotes (") after @=.

A good way to test this is by copying everything between the " and pasting it into the Run dialog.

This will work:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pause updates\command]
@="cmd /c reg import pausewu.reg && start ms-settings:windowsupdate"

Note: Any quotation marks or backslashes used in commands will need to be escaped (\", \\).

A better way

A better alternative is to create batch files and run those instead. Create a file (ex: pause.bat) containing your commands:

@ECHO off
reg import pausewu.reg
start ms-settings:windowsupdate

Then use the following in your .reg file:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pause updates\command]
@="cmd /c \"C:\\your\\path\\pause.bat\""

Note: Again, any quotation marks or backslashes used in commands will need to be escaped (\", \\).

Why that's better

This approach is better for a number of reasons:

  1. You only need to run your .reg file once and can make modifications to your batch files as you see fit. The less you edit the registry manually the better.
  2. If you want to add more commands or commands that require any fancy features, this is the only way.
  3. Making a mistake in the batch file won't break the registry. Making a mistake in the registry can cause huge headaches.
  4. You can make easy backups of your batch files if you're testing something.

Before the Windows 10 Creators Update, the context menu had an option called Open command window here that was available when you pressed Shift + right-click on a folder.

Microsoft wants everyone to use PowerShell instead of the Command Prompt. So, in the Creators Update, they changed the Open command window here option to Open PowerShell window here on the folder context menu. They also changed the Command Prompt options on the Power User Menu (Windows key + X) to PowerShell. But we already showed you how to switch that back.

Today we’ll show you how to add the Open command window here option back to the folder right-click menu and to the right-click menu when you’re in a folder. This doesn’t have to replace the Open PowerShell window here option. You can have both if you want. But you can also hide the PowerShell option if you don’t want it, and we’ll show you how to do that, too.

What You Should Do Before Editing the Registry

To make the changes we talk about here, you must make changes to the registry.

The Registry Editor is a powerful tool that can render your system unstable or even inoperable if misused. This is a fairly simple change and if you follow our instructions, you shouldn’t have any problems. But make sure you back up the Registry and back up your computer before making changes.

You should also make a System Restore point before continuing so, if something goes wrong, you can always roll back.

Add the “Open command window here” Option to the folder context menu

To add the Open command window here option to the context menu that displays when you right-click on a folder, press Windows key + R to open the Run dialog box.

Then, type: regedit into the Open box and click OK.

If the User Account Control dialog box displays, click Yes to continue. You may not see this dialog box, depending on your User Account Control settings.

How do I Run command prompt from registry?

Navigate to the following registry key. You can copy the full path below, paste it into the box just under the menu bar, and press Enter to get to the key quickly.

HKEY_CLASSES_ROOT\Directory\shell\cmd

Take ownership of the cmd key and give yourself full control permission.

How do I Run command prompt from registry?

Make sure the cmd key is selected. Then, right-click on the HideBasedOnVelocityId value on the right and select Rename.

How do I Run command prompt from registry?

Change the name of the HideBasedOnVelocityId value to ShowBasedOnVelocityId and press Enter.

How do I Run command prompt from registry?

Close the Registry Editor and restart the Windows Explorer process.

How do I Run command prompt from registry?

Now you can Shift + right-click on a folder, not in it, and select Open command window here.

Notice that the Open PowerShell window here option is still there. If you’re not going to use that option, see the next section to hide it.

How do I Run command prompt from registry?

Hide the “Open PowerShell window here” Option

If you want to hide the Open PowerShell window here option, go to the following path in the Registry Editor:

HKEY_CLASSES_ROOT\Directory\shell\Powershell

Then, take ownership of the Powershell key and give yourself full control permission

How do I Run command prompt from registry?

Right-click on the ShowBasedOnVelocityId value, select Rename, and change the name to HideBasedOnVelocityId.

Close the Registry Editor and restart the Windows Explorer process.

The Open PowerShell window here option is removed from the right-click menu in File Explorer.

How do I Run command prompt from registry?

Add the “Open command window here” Option to the Context Menu in an Open Folder

So far, we’ve explained how to add the Open command window here option to the context menu when you Shift + right-click on a folder, but not in a currently open folder.

You can also enable the Open command window here option on the right-click menu in an open folder.

Open the registry editor as we showed you earlier and go to the following key.

HKEY_CLASSES_ROOT\Directory\Background\shell\cmd

Take ownership of the cmd key and give yourself full control permission.

Make sure the cmd key is selected. In a blank area of the right pane, right-click the HideBasedOnVelocityId value, and click Rename.

Then, change the name to ShowBasedOnVelocityId.

Close the Registry Editor and restart the Windows Explorer process.

How do I Run command prompt from registry?

Now you can be in a folder, Shift + right-click in the right pane of File Explorer, and select Open command window here.

How do I Run command prompt from registry?

Revert Your Changes

To revert your changes, follow the same instructions listed here, but rename the ShowBasedOnVelocityId or HideBasedOnVelocityId value to the other, depending on whether you’re showing or hiding the context menu option.

How do I Run command prompt from registry?