For .exe and .dll files I can create a file version which can be seen in the properties. Can I do the same for a SQL backup file (.bak)?
-
Maybe you could add a comment-line into the backup file with the version number (e.g. `-- Version: 9-3.a`. Explorer wouldn't show it but `grep Version: *.bak` would. – Lorinczy Zsigmond Jan 23 '20 at 08:47
-
1@LorinczyZsigmond SQL Server backup files are binary, not text (unlike MySQL where they're often just a bunch of plaintext `INSERT...` statements) - so that technique of concatenating a SQL comment won't work and may even cause a restore operation to fail if the SQL Server instance is configured to verify backup file hashes/digests. – Dai Jan 23 '20 at 09:26
1 Answers
Short answer:
No.
Long answer:
Yes, but it isn't easy.
Windows Explorer's File Properties' "Details" pane for *.exe
and *.dll
files is populated from the VERSION
and VERSIONINFO
Win32 resources embedded within the file, it is not external metadata.
Explorer does allow shell-extensions to provide "Details" pane content for other file types. This is how Explorer shows metadata from photos, videos and music. There is no built-in shell extension for SQL Server backup files, but you can make your own.
The API is called IPropertySetStorage
and it's concerned with allowing the Windows shell (File Explorer, Common Dialogs, etc) to read and optionally write file metadata (this can be internal or external metadata).
Windows shell extensions can technically be written using C# and .NET, however it is not supported and you will likely run into problems - so you'll need to write it in C++ or Rust (I suppose you could try to build it in VB6 too - except this won't work on x64 computers as there's no VB6 compiler for x64).

- 141,631
- 28
- 261
- 374