java怎么打开命令窗_右键打开命令行窗口CMD

@echo off

SetLocal EnableDelayedExpansion

title Add Cmd to Promot Menu

net session >nul 2>&1

if not "%errorLevel%" == "0" (

echo Oops: This tools must run with administrator permissions!

echo it will popup the UAC dialog, please click [Yes] to continue.

echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"

echo UAC.ShellExecute "%~s0", "%*", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"

exit /b 2

)

REM 还有点问题,%V进不去

@echo ***********************************

@echo * 1: 目录上右键打开CMD *

@echo * 2: 空白处右键打开CMD *

@echo * 3: 盘符上右键打开CMD *

@echo * 4: 空白处以管理员权限打开CMD *

@echo ***********************************

echo.

set /p ch=please input your choose(1/2/3/4):

if %ch%=="" echo You input is null&goto :EOF

set case=1,2,3,4 >nul

echo %case%|findstr "\">nul&if errorlevel 1 goto :err

goto set_%ch%

goto err

:set_1

rem 目录上右键打开CMD

echo Modify Registry ……

reg add "HKLM\SOFTWARE\Classes\Folder\shell\CommandPrompt" /ve /d "在此处打开命令提示符"

reg add "HKLM\SOFTWARE\Classes\Folder\shell\CommandPrompt" /v Icon /t REG_SZ /d "cmd.exe"

reg add "HKLM\SOFTWARE\Classes\Folder\shell\CommandPrompt\command" /ve /d "cmd.exe /s /k pushd \"%%V\""

goto :Done

:set_2

rem 空白处右键打开CMD

reg add "HKCR\Directory\Background\shell\OpenCmd" /ve /d "在此处打开命令提示符"

reg add "HKCR\Directory\Background\shell\OpenCmd" /v Icon /t REG_SZ /d "cmd.exe"

reg add "HKCR\Directory\Background\shell\OpenCmd\command" /ve /d "cmd.exe /s /k pushd \"%%V\""

goto :Done

:set_3

rem 盘符上右键打开CMD

reg add "HKCR\Drive\shell\OpenCmd" /ve /d "在此处打开命令提示符"

reg add "HKCR\Drive\shell\OpenCmd" /v Icon /t REG_SZ /d "cmd.exe"

reg add "HKCR\Drive\shell\OpenCmd\command" /ve /d "cmd.exe /s /k pushd \"%%V\""

goto :Done

:set_4

rem 空白处以管理员权限打开CMD

reg add "HKCR\Directory\Background\shell\runas" /ve /d "以管理员身份打开命令提示符"

reg add "HKCR\Directory\Background\shell\runas" /v HasLUAShield /t REG_SZ /d ""

reg add "HKCR\Directory\Background\shell\runas\command" /ve /d "cmd.exe /s /k pushd \"%%V\""

goto :Done

:err

goto :EOF

:: error

:Done

if exist "%temp%\getadmin.vbs" (del "%temp%\getadmin.vbs" /f /q)

goto :EOF

echo Done.

echo.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值