过期罐头电脑论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4880|回复: 0
收起左侧

Windows下更高效的打开你的命令行

[复制链接]
看流星划落 2013-6-2 13:35:16 | 显示全部楼层
 正常状况下我门需要.打开CMD, 然后再CD到自己.需要.的目录, 这对偶然用用的人倒没什么. 但是经常需要.这么些操作就感到糜费了大把时间. 现在提供两种方式让你像在linux中那样更高效的在当前目录打开命令行.
  方式一:
  在当前目录按Shift+鼠标右键, 你就可以看到类似的在此处打开命令行的选项了, 假如你想去掉shift,直接按鼠标右键就有此选项, 那么你需要.用简单的修改下你的注册表,
  去注册表位置HKEY_CLASSES_ROOTDirectoryshellcmd 下面将Extended键值删掉, 假如你还希望驱动器和桌面也能这样, 将HKEY_CLASSES_ROOTDrivershellcmd和
  HKEY_CLASSES_ROOTDirectoryBackgroundshellcmd 下的Extended键值去掉即可.
  方式二:
  用快捷键,当然会用到人见人爱的Autohotkey. 其Auothotkey代码如下:
  SetTitleMatchMode RegEx
  return
  ; Stuff to do when Windows Explorer is open
  ;
  #IfWinActive ahk_class ExploreWClass|CabinetWClass
  ; open ‘cmd’ in the current directory
  ;
  #c::
  OpenCmdInCurrent()
  return
  #IfWinActive
  ; Opens the command shell ‘cmd’ in the directory browsed in Explorer.
  ; Note: expecting to be run when the active window is Explorer.
  ;
  OpenCmdInCurrent()
  {
  ; This is required to get the full path of the file from the address bar
  WinGetText, full_path, A
  ; Split on newline (`n)
  StringSplit, word_array, full_path, `n
  ; Take the first element from the array
  full_path = %word_array1%
  ; strip to bare address
  full_path := RegExReplace(full_path, “地址: “, “”)
  ; Just in case – remove all carriage returns (`r)
  StringReplace, full_path, full_path, `r, , all
  IfInString full_path,
  {
  Run, cmd /K cd /D “%full_path%”
  }
  else
  {
  Run, cmd /K cd /D “C: ”
  }
  }
  把上面代码存为UTF-8编码格式(由于有中文)的ahk格式,用Autohotkey打开,然后按win键+C就可以在当前目录下打开cmd命令行了.
  这段小代码肯能有两个你需要.修改的地方
  1. #c:: 中的#代表win键, 这个代码中使用的是win键+C, C可以改成你需要.的其它键
  2. 假如你的系统是英文的,你需要.把”地址: ” 改为 “^Address: “
您需要登录后才可以回帖 登录 | 注册

本版积分规则

一键重装系统|雨人系统下载|联系我们|网站地图|过期罐头电脑论坛

GMT+8, 2024-3-29 01:38 , Processed in 0.033217 second(s), 25 queries .

官方免责声明:本站内容来自网友和互联网.若侵犯到您的版权.请致信联系,我们将第一时间删除相关内容!

Powered by Discuz!

专注于win7_win10_win11系统下载装机

© 2010-2023 GQGTPC.Com

快速回复 返回顶部 返回列表