如何在 macOS Finder 中添加「在終端機中打開」圖示

假設我在 Finder 中打開了一個資料夾,而我想要在終端機中打開它。 為了讓這個操作更加方便,我決定在 Finder 中添加一個「在終端機中打開」圖示: 下面是如何實現這一點的方法。 首先打開 Automator,選擇「應用程式」。 在操作列表中搜索「執行 AppleScript」,然後粘貼以下內容: on run {input, parameters} tell application "Finder" set myPath to (POSIX path of (target of front window as alias)) end tell tell application "Terminal" do script "cd " & myPath activate end tell return input end run 如果你更喜歡使用「執行 Shell 腳本」,可以使用以下 Bash 腳本: osascript -e ' tell application "Finder" set myPath to (POSIX path of (target of front window as alias)) end tell tell application "Terminal" do script "cd " & myPath activate end tell ' 第一個腳本運行的是 osascript(這是一個運行 AppleScript 的腳本),內容如下:...