User Tools

Site Tools


preventing_20the_20_27downloaded_20file_27_20warning

This is an old revision of the document!


Preventing the 'downloaded file' warning

by Richard Russell, June 2009

When you attempt to run an executable file downloaded from the internet (or another computer), Windows may display a 'security warning' dialogue box requiring confirmation before the file is run. This can happen when an NTFS filesystem is in use on Windows XP (SP2 or later), Windows Vista or Windows 7:



Whilst this warning is a valuable security measure, it can be irritating when you know the file to be safe, especially in the context of a file you want to run frequently (such as an add-in utility).

It is easy enough to disable this warning manually, either by deselecting the 'Always ask before opening this file' checkbox, or by right-clicking on the file in Windows Explorer, selecting Properties… then the General tab then clicking on Unblock.

However you may want to spare the user the need to do this by automatically disabling the warning in software, for example when an installer program is run. You can easily do that using the following BBC BASIC code:

        file% = OPENIN(FileName$ + ":Zone.Identifier")
        IF file% THEN
          CLOSE #file%
          file% = OPENOUT(FileName$ + ":Zone.Identifier")
          IF file% CLOSE #file%
        ENDIF

This code first checks to see if the file has a 'Zone.Identifier' stream, and if so replaces it with an empty stream; it will require Administrator Privileges to run.

Obviously you should only do this in circumstances when you are sure the file is safe, because you are bypassing a Windows security feature.

Note

This article is applicable to files which have first been downloaded from the internet (or another computer) and then subsequently run from the local disk. The warning which is displayed when you attempt to execute a file directly from a web site is a different issue, and can only be suppressed by 'signing' the executable with a code signing certificate.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
preventing_20the_20_27downloaded_20file_27_20warning.1522502374.txt.gz · Last modified: 2024/01/05 00:17 (external edit)