I want to script the "This file was retrieved from another computer" flag.

Asked 2 years ago, Updated 2 years ago, 341 views

Current state

If you download a file from a browser on Windows, especially Chrome, and look at its properties,
"This file was retrieved from another computer.Access to this file may be blocked to protect this computer.
It may have notes such as

Of course, if you check & K and press the OK button, the flag will fall off the file, and it doesn't seem to cause any actual damage, but I feel itchy, so I would like to wash off all the large files I have.

Question

What kind of code should I write about this flag to check if it is standing or to drop it if it is standing?Please let me know if there is a sample code somewhere.Just a pointer to the API you need to refer to would be helpful.

This is the approximate language that we can use for this application:

  • Use Scripting.FileSystemObject, etc. in the WSH
  • Write a console app in MinGW-w64 and invoke the Win32 API from it
  • Write in ActivePerl and use the standard library and Win32 API.

However, other than that, I think I can understand most general-purpose languages by reading the code.
(PowerShell and others are amazing, but...)

Thank you for your cooperation.

P.S.
I plan to work with Windows 10 for the time being, but the Windows XP machine is still running as a file server printer server, so I hope the code works with XP.

windows

2022-09-30 22:05

2 Answers

As for unblocking (removing while standing), I use the Unblock-File cmdlet on powershell.
You can use it the same way as a command prompt, so why don't you try it?


2022-09-30 22:05

It's in the "Alternate Data Stream" area of the NTFS file system.
https://atmarkit.itmedia.co.jp/ait/articles/1407/11/news111.html

Depending on the tool you use, for example, to see if the file a.exe is flagged
a.exe: You can cat Zone.Identifier to see what's inside.

It can be handled almost like a file, so you can delete it
dela.exe —Disappears in Zone.Identifier.
Verified that the del command at the command prompt disappears.


2022-09-30 22:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.