添加到注册表
新建txt文本,保存以下代码并以.reg后缀名保存,运行后成功实现。
Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="在此处打开命令行窗口"[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe -noexit -command Set-Location -literalPath \"%V\""[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="在此处打开命令提示符(管理员)"
"Icon"="cmd.exe"
"Extended"=""[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
"ShowBasedOnVelocityId"=dword:00639bc8
@="cmd.exe /s /k pushd \"%V\""
删除上面添加注册表数据
Windows Registry Editor Version 5.00[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere][-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]