在Mac OS X Yosemite上切换隐藏/显示隐藏文件的最快方法是什么?

ior*_*ori 11 terminal applescript finder osx-yosemite

我在优胜美地,我想切换隐藏/显示Mac上的所有隐藏文件.

每次,我想这样做,我必须去Terminal.app并运行这些命令:

显示

defaults write com.apple.finder AppleShowAllFiles TRUE

隐藏

defaults write com.apple.finder AppleShowAllFiles FALSE

我想知道是否有一个更好的调整,只需点击一下按钮即可实现这一目标.

Han*_* .T 37

我更喜欢使用此快捷方式:

⌘ CMD+ ⇧ SHIFT+.

  • 尼斯!在macOS Mojave v10.14上工作! (2认同)

use*_*603 4

更新,考虑所有评论:

try
    set state to (do shell script "defaults read com.apple.finder AppleShowAllFiles") as boolean
on error
    set state to false
end try

do shell script "defaults write com.apple.finder AppleShowAllFiles " & (not state)

try
    tell application "Finder"
        set w to front window
        set t to (get target of w)
        if t is not startup disk then
            set the target of w to startup disk
        else
            set the target of w to home
        end if
        set the target of w to t
    end tell
end try

tell application (path to frontmost application as text)
    display notification "ShowAllFiles is now " & (not state)
end tell
Run Code Online (Sandbox Code Playgroud)

将脚本导出为应用程序,然后将应用程序 cmd 拖至 Finder 窗口工具栏。

  • 如果您只想一键使用此脚本,请将其另存为应用程序,然后使用 cmd 将其拖动到 Finder 窗口的工具栏。那么就可以在每个窗口中快速访问它! (3认同)