BAT批处理设置Shift右键cmd菜单

@%1 start "" mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c""%~s0"" ::","","runas",1)(window.close)&&exit
@echo off 
@CLS
@color 0a
GOTO MENU
:MENU
ECHO.
ECHO.=-=-=-=-=菜单=-=-=-=-=
ECHO.
ECHO. 1.  修改shift右键菜单为CMD
ECHO.
ECHO. 2.  修改shift右键菜单为Powershell
ECHO. ECHO. 3. 退 出 ECHO. ECHO. ECHO. echo.请输入选择项目的序号: set id=0 set /p id= if "%id%"=="1" goto cmd1 if "%id%"=="2" goto cmd2

if "%id%"=="3" exit echo 输入的序号不能识别,请重新输入! ::pause >nul goto MENU :cmd1 echo 执行命令 在shift右键菜单中添加为CMD (REG QUERY "HKLM\SOFTWARE\Classes\Directory\background\shell\cmd" /v HideBasedOnVelocityId) >nul 2>nul if %errorlevel% == 0 ((REG DELETE "HKLM\SOFTWARE\Classes\Directory\background\shell\cmd" /v HideBasedOnVelocityId /f) >nul 2>nul) (REG QUERY "HKLM\SOFTWARE\Classes\Directory\background\shell\Powershell" /v ShowBasedOnVelocityId ) >nul 2>nul if %errorlevel% == 0 ((REG DELETE "HKLM\SOFTWARE\Classes\Directory\background\shell\Powershell" /v ShowBasedOnVelocityId /f) >nul 2>nul) rem import register file cd /d "%~dp0" (REG IMPORT ToCMD.reg) >nul 2>nul if %errorlevel% == 0 (echo 修改成功!) if %errorlevel% == 1 (echo 修改失败!) goto MENU :cmd2 echo 执行命令 在shift右键菜单中添加Powershell (REG QUERY "HKLM\SOFTWARE\Classes\Directory\background\shell\cmd" /v ShowBasedOnVelocityId) >nul 2>nul if %errorlevel% == 0 ((REG DELETE "HKLM\SOFTWARE\Classes\Directory\background\shell\cmd" /v ShowBasedOnVelocityId /f) >nul 2>nul) (REG QUERY "HKLM\SOFTWARE\Classes\Directory\background\shell\Powershell" /v HideBasedOnVelocityId) >nul 2>nul if %errorlevel% == 0 ((REG DELETE "HKLM\SOFTWARE\Classes\Directory\background\shell\Powershell" /v HideBasedOnVelocityId /f) >nul 2>nul) rem import register file cd /d "%~dp0" (REG IMPORT ToPowershell.reg) >nul 2>nul if %errorlevel% == 0 (echo 修改成功) else (echo 修改失败) GOTO MENU

 

 

ToCMD.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
"ShowBasedOnVelocityId"=dword:00639bc8
"Icon"="cmd.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Powershell]
@="@shell32.dll,-8508"
"Extended"=""
"NoWorkingDirectory"=""
"HideBasedOnVelocityId"=dword:00639bc8

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Powershell\command]
@="powershell.exe -noexit -command Set-Location -literalPath '%V'"

 

ToPowershell.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Powershell]
@="@shell32.dll,-8508"
"Extended"=""
"NoWorkingDirectory"=""
"HideBasedOnVelocityId"=dword:00639bc8

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Powershell\command]
@="powershell.exe -noexit -command Set-Location -literalPath '%V'"

 

转载于:https://www.cnblogs.com/2018shawn/p/11113093.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值