如何重命名启动盘?
How to rename startup disk?
我运行下面的代码重命名启动盘,执行一些程序
我的问题是,在执行这些过程后,我是否可以将磁盘重命名为它的名称“Original”
也就是说,我有一个名为“Big Sur”的磁盘,运行它下面的代码重命名为:“Apple HD”
但在执行其他任务后不久,它 returns 将名称更改为:Big Sur 我尝试将名称存储在变量中,但这不起作用,因为启动磁盘在运行时被重命名为“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
我运行下面的代码重命名启动盘,执行一些程序 我的问题是,在执行这些过程后,我是否可以将磁盘重命名为它的名称“Original”
也就是说,我有一个名为“Big Sur”的磁盘,运行它下面的代码重命名为:“Apple HD” 但在执行其他任务后不久,它 returns 将名称更改为:Big Sur 我尝试将名称存储在变量中,但这不起作用,因为启动磁盘在运行时被重命名为“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