First, you want to open up regedit and navigate to Computer\HKEY_CLASSES_ROOT\batfile\shell\open\command
. Right click on the value named "Default" and click modify, change the value data to wt.exe -w 0 new-tab -d . "%1" %*
. You can stop here if you wish as now when you run a .bat it will open in Windows Terminal. But if you want to be able to right click on a file and have the option to run in cmd, make a new key in Computer\HKEY_CLASSES_ROOT\batfile\shell
called wtopen
, change the "Default" value data in that to "Open in cmd". Then, make a subkey in Computer\HKEY_CLASSES_ROOT\batfile\shell\wtopen
called "command" and change the "Default" value data to "%1" %*
. Now if you right click on a .bat you should have the option to "Run in cmd".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK | |
if NOT EXIST Private goto MDPrivate | |
:CONFIRM | |
echo Are you sure to lock this folder? (Y/N) | |
set/p "cho=>" | |
if %cho%==Y goto LOCK | |
if %cho%==y goto LOCK | |
if %cho%==n goto END | |
if %cho%==N goto END |