我可以在 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 中调用它。大家能帮忙吗?
最佳答案
是的,您所要做的就是从 Python 调用以下命令行:
powershell.exe -Command Unblock-File -Path "c:\path\to\blocked file.ps1"
关于python - 从 python 脚本解锁 Windows 中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20886450/