其实一个命令行就搞定,但是还是比点一下麻烦啊
显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles YES
隐藏Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles NO
输完单击Enter键,退出终端,重新启动Finder就可以了
重启Finder:鼠标单击窗口左上角的苹果标志-->强制退出-->Finder-->重新启动
显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles YES
隐藏Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles NO
输完单击Enter键,退出终端,重新启动Finder就可以了
重启Finder:鼠标单击窗口左上角的苹果标志-->强制退出-->Finder-->重新启动
(*
显示或隐藏,隐藏文件
*)
tell application "Finder"
activate
set IsTrueOrFalse to "FALSE"
set IsTrueOrFalse to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if IsTrueOrFalse is "FALSE" or IsTrueOrFalse is "NO" or IsTrueOrFalse is "0" or IsTrueOrFalse is "OFF" then
set IsTrueOrFalse to "TRUE"
set UserDisplay to "显示"
else
set IsTrueOrFalse to "FALSE"
set UserDisplay to "隐藏"
end if
display dialog "你确定要" & UserDisplay & "系统文件?" with title "显示或隐藏系统文件" with icon stop buttons {"关闭", "确定"} default button 2
copy the result as list to {buttonpressed}
if buttonpressed is "确定" then
do shell script "defaults write com.apple.finder AppleShowAllFiles " & IsTrueOrFalse
my ReStartFinder()
end if
end tell
on ReStartFinder()
try
tell application "Finder" to quit
on error
error "退出Finder时出现错误.请使用强制退出(cmd-option-esc) "
end try
set finderIsActive to false
set errorCount to 0
repeat until finderIsActive
try
tell application "Finder" to activate
set finderIsActive to true
on error
set errorCount to errorCount + 1
if (errorCount > 20) then
error "重新启动Finder时出现错误.请点击Finder图标来起动它."
end if
delay 0.2
end try
end repeat
end ReStartFinder