我应该使用哪个命令将评论(来自文件或剪贴板)添加到 macOS 中文件(任何文件)的“评论”部分?
这些注释用于 Spotlight 索引,显然可以从 Finder (⌘+i) 手动添加,但出于我的目的,我希望能够从命令行执行此操作(在 Bash 脚本中使用)。
最佳答案
我found在 macOS 10.13 中对我有用的一个很好的片段:
osascript -e 'on run {f, c}' -e 'tell app "Finder" to set comment of (POSIX file f as alias) to c' -e end "/path/to/your.file" "hello world"
关于bash - 在 macOS 中使用命令行向文件添加(Spotlight)注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45162321/