This is a duplicate of this question: How to set (restore) the com.apple.quarantine attribute?
This is the summary of the top answer (currently):
You can copy an existing com.apple.quarantine attribute of an arbitrary file to a proxy file and then apply it to arbitrary other files. If you open certain file types (e.g. .txt files) the quarantine attribute will be ignored though.
Example:
xattr -p com.apple.quarantine /Users/user/dnscrypt-osxclient-1.0.12.dmg quarantine.attr
xattr -w com.apple.quarantine "cat quarantine.attr
" test.command
This will apply the data gathered from the .dmg to the .command file - including download date and download app of the original dmg file. The original download date/app of the .command won't be restored though.
Source: Using xattr to set the Mac OSX quarantine property
For more details, go check out the original answer here (which I have quoted)