Cygwin/MSYS2文件夹书签功能函数,调用Windows资源管理器快速打开文件夹;
2022/3/27 7:24:30
本文主要是介绍Cygwin/MSYS2文件夹书签功能函数,调用Windows资源管理器快速打开文件夹;,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
favorite-dirs函数
如需使用第三方软件或插件打开文件夹路径,只需替换代码中的explorer.exe
为第三方软件可执行文件名即可,比如可以替换成total commander
等软件的可执行程序;(注意可能需要填写软件程序的完整路径),
favorite-dirs() { #使用资源管理器快速打开Windows系统常用文件夹 local mydirs=$(cat<<EOF Shell:downloads Shell:documents Shell:Sendto Shell:Quick Launch Shell:AppData %LocalAppdata% Shell:startup Shell:common startup Shell:programfiles Shell:programfilesx86 %UserProfile% %UserProfile%\.ssh Shell:ProgramFiles\git Shell:ProgramFiles\git\etc Shell:AppData\Google Shell:programfilesx86\NetSarang D:\MySelf\shell-scripts D:\Work\Documents EOF ) #输出选择菜单: echo "$mydirs"|awk '{printf NR"): ";print}' while :; do read -p "请输入序号选择,可一次性输入多个选项[用空格隔开](输入 0 退出选择,输入 p 再次打印目录选项):" dirChoose if [ ! -z "$dirChoose" ];then if [[ "${dirChoose,,}" == "p" ]];then echo "$mydirs"|awk '{printf NR"): ";print}' continue fi if [[ "$dirChoose" == "0" ]];then echo "exit..." break fi open-single-dir() { #local targetDir=$(echo "$mydirs"|awk "NR==$dirChoose"'{gsub(/^\s*/,"");print;exit}') local targetDir=$(echo "$mydirs"|awk "NR==$1"'{gsub(/^\s*/,"");print;exit}') if [ ! -z "$targetDir" ];then echo "Open Dir $targetDir ..." cmd /c explorer.exe "$targetDir " else echo "targetDir is empty!" fi } mapfile -t -d $' ' myDirArr<<<"$dirChoose" for dir in ${myDirArr[@]}; do #echo "open dir:$dir" open-single-dir $dir done else echo "Have No Choice...!" fi done } alias mydirs='favorite-dirs' alias d3='favorite-dirs'
这篇关于Cygwin/MSYS2文件夹书签功能函数,调用Windows资源管理器快速打开文件夹;的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-07-02微服务启动nacos注册上去了,但是一直没有收到请求-icode9专业技术文章分享
- 2024-07-02如何检查文件的编码格式-icode9专业技术文章分享
- 2024-07-02sublime 更改编码格式-icode9专业技术文章分享
- 2024-06-30uniAPP 实现全屏左右滚动滚动的效果-icode9专业技术文章分享
- 2024-06-30如何在本地使用授权或插件-icode9专业技术文章分享
- 2024-06-30伪静态规则配置方法汇总-icode9专业技术文章分享
- 2024-06-29易优CMS安装常见问题汇总-icode9专业技术文章分享
- 2024-06-28易优新手必读安装教程-icode9专业技术文章分享
- 2024-06-28忘记eyoucms后台密码怎么办?-icode9专业技术文章分享
- 2024-06-26终极指南:Scrum中如何设置需求优先级