The Details tab in the Properties sheet shows the file version, product name, copyright, and other details. However, Windows doesn’t let you copy the information to the clipboard.
In this article let’s see how to copy the file info to the clipboard using PowerShell. You can also incorporate the command to the right-click menu if desired.
Copy File Information via the Context Menu
You can add a “Copy File Info” command to the right-click menu for desired file types (.exe, .dll, .ocx, .sys, etc). This context menu item can be set to copy the file details to the clipboard automatically. Follow these steps to do so:
- Download or create your own REG file (e.g.,
copy_file_info.reg
) from the following contents:
- Double-click the registry file and click Yes when asked for confirmation.
The “Copy File Info” context menu is now added for .exe, .dll, .ocx, and .sys file types.
Note: To reduce clutter in the right-click menu, the menu item is implemented as an extended context menu. This means the item would be visible only if you press the Shift
key and right-click on the said file type. Also, the menu item is set to appear only for .exe, .dll, .sys, and .ocx file types.
A PowerShell window would open and close quickly, copying the file details to the clipboard. He are some sample data:
FileVersionRaw : 1.1.0.0 ProductVersionRaw : 1.1.0.0 Comments : CompanyName : Sysinternals - www.sysinternals.com FileBuildPart : 0 FileDescription : Run as different user FileMajorPart : 1 FileMinorPart : 1 FileName : D:\tools\ShellRunAs.exe FilePrivatePart : 0 FileVersion : 1.01 InternalName : ShellRunas IsDebug : False IsPatched : False IsPrivateBuild : True IsPreRelease : False IsSpecialBuild : False Language : English (United States) LegalCopyright : Copyright ? 2008 Mark Russinovich and Jon Schwartz LegalTrademarks : OriginalFilename : ShellRunas PrivateBuild : ProductBuildPart : 0 ProductMajorPart : 1 ProductMinorPart : 1 ProductName : Sysinternals ShellRunAs ProductPrivatePart : 0 ProductVersion : 1.01 SpecialBuild :
FileVersionRaw : 10.0.19041.1706 ProductVersionRaw : 10.0.19041.1706 Comments : CompanyName : Microsoft Corporation FileBuildPart : 19041 FileDescription : Windows Explorer FileMajorPart : 10 FileMinorPart : 0 FileName : C:\Windows\explorer.exe FilePrivatePart : 1706 FileVersion : 10.0.19041.1620 (WinBuild.160101.0800) InternalName : explorer IsDebug : False IsPatched : False IsPrivateBuild : False IsPreRelease : False IsSpecialBuild : False Language : English (United States) LegalCopyright : ? Microsoft Corporation. All rights reserved. LegalTrademarks : OriginalFilename : EXPLORER.EXE.MUI PrivateBuild : ProductBuildPart : 19041 ProductMajorPart : 10 ProductMinorPart : 0 ProductName : Microsoft? Windows? Operating System ProductPrivatePart : 1706 ProductVersion : 10.0.19041.1620 SpecialBuild :
(Note that FileVersionRaw and ProductVersionRaw are different from FileVersion and ProductVersion data. For further reading, check out How to (correctly) check file versions with PowerShell)
Get File Info using PowerShell manually
If you rather prefer to get file info manually (instead of a context menu addition), you need to open PowerShell and use the following command-line example:
(Get-Item "D:\tools\ShellRunAs.exe").VersionInfo | format-list * -force
To copy the items to the Clipboard, run:
(Get-Item "D:\tools\ShellRunAs.exe").VersionInfo | format-list * -force | Clip
Tip: You can also use the following PowerShell “Set-Clipboard
” method as an alternative to Clip.exe.
(Get-Item "D:\tools\ShellRunAs.exe").VersionInfo | format-list * -force | Out-String | Set-Clipboard
Useful Links (Third-party)
- How to (correctly) check file versions with PowerShell – Microsoft Tech Community
- Get file version in PowerShell – Stack Overflow
- File version information is incorrect · Issue #6008 · PowerShell
- How to get file version and product version same as file property dialogue? : PowerShell
Note that if the asterisk *
is not used in the above example(s), many of the file properties (especially the patch/updated file version info) are hidden in the output.
One small request: If you liked this post, please share this?
One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
Hello, I tried the code you gave for right click in your article on two different computers, I followed the order of operations step by step, it says the keys and values in reg have been successfully applied to the registry, but copy file information does not appear on right click.
@Murat: Press and hold Shift and then press right-click.