从python脚本取消阻止windows中的文件

2024-04-26 03:56:46 发布

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

我能在windows(7)中解除阻止一个文件吗?这个文件被windows(从互联网下载)从python脚本自动阻止?遇到这样的文件时会引发WindowsError。我想捕捉这个异常,然后运行一个powershell脚本,它的内容如下:

Parameter Set: ByPath
Unblock-File [-Path] <String[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByLiteralPath
Unblock-File -LiteralPath <String[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

我不懂powershell脚本。但如果我有一个,我可以从python中调用它。你们能帮忙吗?在


Tags: 文件脚本stringparameterwindows互联网confirmfile