Python:在windows中更改文件/文件夹属性

2024-09-28 16:58:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我用python3脚本创建了一个文件夹,要对文件夹应用多个属性(+h+s),我必须在命令提示符下运行ATTRIB命令。 但我想知道如何用同一个python3脚本来完成。在

import os

os.makedir("C:\\AutoSC")

# Now I want the code to give the same result such that I have opned CMD and writen following command
# C:\> attrib +h +s AutoSC

# Also show in the code, necessary imported modules

我希望文件夹被创建并立即隐藏为系统文件夹。 即使在显示隐藏文件后也不可见。在


Tags: theimport命令脚本文件夹属性oscode