Python:重命名标签中带有 space 字符的驱动器卷

Python: Rename drive volume with space character in label

我正在尝试重命名驱动器卷标,但如果卷标包含 space

,我会收到错误消息
import subprocess
subprocess.run(['label', 'L:test 1'])

产生此错误:

Access Denied as you do not have sufficient privileges or the disk may be locked by another process. You have to invoke this utility running in elevated mode and make sure the disk is unlocked.

如果我删除 space subprocess.run(['label', 'L:test1'])

,代码可以正常工作

如何将 space 添加到我的标签中?

尝试subprocess.run(['label', 'L:test', '1'])。 它通过串联工作 - 愚蠢,但真实。