如何重命名启动盘?



我正在运行下面的代码来重命名启动磁盘,以执行一些过程我的问题是,在执行这些步骤后,我是否可以将磁盘重命名为它的名称"original">

也就是说,我有一个名为"大磁盘"的磁盘。并运行下面的代码,它被重命名为:"Apple HD"我试图将名称存储在一个变量中,但这不起作用,因为启动磁盘在运行时被重命名为"Apple hd"。

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
-- 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

相关内容