windows鼠标右键打开cmd、管理员模式

我们可以通过编写.reg文件的方式来右键打开cmd、管理员/非管理员的方式

代码如下,Windows直接新建txt,粘贴进去保存,然后选择另存为,保存类型选所有文件、编码选ANSI、文件名为CmdAndPowershellAll.reg(名字无所谓,后缀为.reg就可以)。双击打开,会进行两次确认,然后会提示“已成功添加到注册表中”,这样就成功了!现在可以右键、shift+右键尝试一下了!

Windows Registry Editor Version 5.00
 
; 原文链接:
; https://blog.csdn.net/cxrsdn/article/details/84538767
 
; 若原先有,先删除原来的
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]
 
; 1.鼠标右键:命令行
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="CMD Here"
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe -noexit -command Set-Location -literalPath \"%V\"" 
 

; 2.鼠标右键:命令行(管理员)
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="CMD Here (Admin)"
"ShowBasedOnVelocityId"=dword:00639bc8
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
 


; 3.shift+鼠标右键:Powershell(管理员)
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]
@="Powershell Here (Admin)"
"Extended"=""
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\command]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"

你可能感兴趣的:(工具)