总所周知,新版本微信在下载文件后会设置为只读,很多软件打开了要另存为才能可写,非常不方便 于是我让gpt写了个脚本来解除 ``` import argparse import os import subprocess # 解析命令行参数 parser = argparse.ArgumentParser() parser.add_argument('-dir', '--directory', help='directory to remove read-only attribute', default=os.getcwd()) args = parser.parse_args() # 获取目录路径 path = args.directory # 构造命令 command = 'attrib -r ' + path + '\\* /s' # 执行命令 subprocess.call(command, shell=True) ``` 用法: 解除脚本所在目录`python unlock.py` 解除其他目录`python unlock.py -dir ` Loading... 总所周知,新版本微信在下载文件后会设置为只读,很多软件打开了要另存为才能可写,非常不方便 于是我让gpt写了个脚本来解除 ``` import argparse import os import subprocess # 解析命令行参数 parser = argparse.ArgumentParser() parser.add_argument('-dir', '--directory', help='directory to remove read-only attribute', default=os.getcwd()) args = parser.parse_args() # 获取目录路径 path = args.directory # 构造命令 command = 'attrib -r ' + path + '\\* /s' # 执行命令 subprocess.call(command, shell=True) ``` 用法: 解除脚本所在目录`python unlock.py` 解除其他目录`python unlock.py -dir <directory_path> ` Last modification:November 7, 2023 © Allow specification reprint Like 如果觉得我的文章对你有用,请随意赞赏