为Windows右键菜单提供打开命令行选项

前端之家收集整理的这篇文章主要介绍了为Windows右键菜单提供打开命令行选项前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面是编程之家 jb51.cc 通过网络收集整理的代码片段。

编程之家小编现在分享给大家,也给大家做个参考。

:: 更新说明
::
:: 版本:V1.0
:: 日期:2012-07-31
:: 说明:实现右健菜单“打开命令行”的添加删除
::
@echo off
title 右键菜单打开命令行
echo.
echo 本程序可为任意文件文件夹的右键菜单添加“打开命令行”菜单

:menu
echo.
echo 1.安装 2.卸载 3.退出
set /p choice=请选择操作:
echo.
if /i "%choice%" == "1" goto install
if /i "%choice%" == "2" goto remove
if /i "%choice%" == "3" goto exit
echo 输入无效,请重新选择!
goto menu

:install
reg add hkcr\Folder\shell\cmdhere /ve /t REG_SZ /d "打开命令行" /f > nul
reg add hkcr\Folder\shell\cmdhere\command /ve /t REG_SZ /d "cmd.exe /s /k pushd \"%%1\"" /f > nul
reg add hkcr\*\shell\cmdhere /ve /t REG_SZ /d "打开命令行" /f > nul
reg add hkcr\*\shell\cmdhere\command /ve /t REG_SZ /d "cmd.exe" /f > nul
echo 安装完成!
echo.
pause
goto exit

:remove
reg delete hkcr\Folder\shell\cmdhere\ /f > nul
reg delete hkcr\*\shell\cmdhere /f > nul
echo 卸载完成!
echo.
pause
:exit
:: 恢复窗口标题
title %comspec%

以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

猜你在找的Shell相关文章