使用Powershell阻止文件 [英] Block a file with Powershell

查看:102
本文介绍了使用Powershell阻止文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Powershell阻止(而不是取消阻止)文件.我想让Windows相信磁盘上的文件是从Internet下载的,或者存在任何其他情况导致文件被阻止的情况.我需要使用它来测试正在开发的某些软件在存在阻止文件的情况下的行为.

I want to block (not unblock) a file with Powershell. I want to cause Windows to believe that a file on disk was downloaded from the internet, or whatever other scenario exists such that files become blocked. I need this to test how some software I'm developing behaves in the presence of a blocked file.

推荐答案

如果您只是想添加区域标识符,则可以尝试如下操作:

If you're just trying to add the zone identifier you could try something like this:

$data = "[ZoneTransfer]
ZoneId=3"

Set-Content example.txt -Stream "Zone.Identifier" -Value $data

这篇关于使用Powershell阻止文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆