HowTo: Add cmd.exe to right click context menu
If you want the command prompt to be available whenever you right click on objects on your desktop or explorer, you can opt to create the keys in the registry:
- HKEY_CLASSES_ROOT\Folder\shell\MenuText\Command
Change the (Default) value to cmd.exe /k cd "%1"
Or you can script it!
Code Snippet:
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Dim WSHShell, objWMIService, strComputer, lcValue1
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objWSHShell = WScript.CreateObject("WScript.Shell")
Set objRegObj = WScript.CreateObject("RegObj.Registry")
objWSHShell.Popup "This will enable CMD with explorer options for the Current User"
objWSHShell.RegWrite "HKCR\Folder\Shell\MenuText\Command\", "cmd.exe /k cd " & chr(34) & "%1" & chr(34)
objWSHShell.RegWrite "HKCR\Folder\Shell\MenuText\", "Launch CMD"
tmp = objWSHShell.RegRead("HKCR\Folder\Shell\MenuText\")
objWSHShell.Popup ("Current Value: " + tmp)
If at first you fail, call it version 1.0
No comments:
Post a Comment