I have loads of .exe files that got renamed to file1.exe, file2.exe, etc. When you look at a file's Details under Properties (in Windows Explorer), it has the original file name under "Product Name". I am trying to find a way to batch rename them all back to the product name. There are tools that can do this with images, music, etc., but I can't find anything out there that will do it for applications. This would be (fairly) straightforward if there were some way to access the Properties → Details in a command line (batch) context.


You can use PowerShell to do this.

$newname=(get-item .\file1.exe).VersionInfo.ProductName
Rename-Item .\file1.exe -NewName "$newname.exe"


Here's a one-liner that should accomplish what you need:

(gci).name | Where-Object {$_ -like 'file*.exe'} | foreach { $name=(get-item $_).versioninfo.productname;rename-item $_ -NewName "$name.exe"}

to make it like ProductName_ProductVersion.exe :

(gci -Path "E:\test" -Filter *.exe).FullName | %{$NewName = (Get-Item $_).VersionInfo.ProductName +"_" + (Get-Item $_).VersionInfo.ProductVersion;Rename-Item $_ -NewName "$($NewName).exe"}

and if you want to make it like ProductName_FileVersion.exe just replace ProductVersion with FileVersion in code

DO NOT forget to replace E:\test with true path

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.