首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何重命名启动盘?

如何重命名启动盘?
EN

Stack Overflow用户
提问于 2021-10-19 15:37:03
回答 1查看 42关注 0票数 0

我正在运行下面的代码来重命名启动盘,执行一些过程我的问题是,在执行完这些过程后,我是否可以将磁盘重命名为它的名称“原始”。

也就是说,我有一个名为"Big Sur“的磁盘,并运行下面的代码,它被重命名为:"Apple HD”,但在执行其他任务后不久,它将名称返回到: Big Sur我试图将名称存储在一个变量中,但这不起作用,因为启动盘在运行时被重命名为"Apple HD“。

代码语言:javascript
复制
tell application "Finder" to set diskName to name of startup disk
set newName to "Apple HD"

tell application "Finder" 
to set newName to diskName
end tell
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-20 04:08:43

代码语言:javascript
复制
-- save original name into the variable, to restore it later
tell application "Finder" to set diskName to name of startup disk

-- rename startup disk
tell application "Finder" to set name of startup disk to "Apple HD"

-- perform some procedures here

-- rename startup disk back to original name
tell application "Finder" to set name of startup disk to diskName
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69633819

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档