Mac隐藏/显示桌面图标

//隐藏

1
defaults write com.apple.finder CreateDesktop -bool FALSE;killall Finder

//显示

1
defaults delete com.apple.finder CreateDesktop;killall Finder

实用工具-AppleScript编辑器

1
2
3
4
5
6
7
display dialog "桌面图标设置为可见或隐藏?" buttons {"可见", "隐藏"} with icon 2 with title "Switch to presentation mode" default button 1
set switch to button returned of result
if switch is "隐藏" then
do shell script "defaults write com.apple.finder CreateDesktop -bool FALSE;killall Finder"
else
do shell script "defaults delete com.apple.finder CreateDesktop;killall Finder"
end if

显示隐藏文件/文件夹

1
2
3
4
5
6
7
8
9
10
//显示
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

//隐藏
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

//OS X Mountain Lion
defaults write com.apple.finder AppleShowAllFiles TRUE ; killall Finder
defaults write com.apple.finder AppleShowAllFiles FALSE ; killall Finder

shell脚本

1
2
3
4
5
6
7
8
STATUS=`defaults read com.apple.finder AppleShowAllFiles` 
if [ $STATUS == YES ];
then
defaults write com.apple.finder AppleShowAllFiles NO
else
defaults write com.apple.finder AppleShowAllFiles YES
fi
killall Finderß
文章作者: kyren
文章链接: http://huluo666.github.io/2016/05/12/Mac隐藏:显示桌面图标/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Kyren's Blog