0

I have a bunch of shortcuts and right now the shortcuts does not have very meaningful names.

I need to rename them so that the shortcut name is equal to the description of the shortcut.

enter image description here

It is about 1000+ files. Is there any way of doing a batch operation or automation?

Arete
  • 1,600

2 Answers2

0

Thanks to JasonMArcher's answer, you can do something like this for every shortcut in the folder using Powershell:

$lnk = "path\to\shortcut.lnk"
$dest = $Env:Userprofile + "\Desktop\"
$shell = New-Object -COM WScript.Shell
Copy-Item $lnk $($dest + 
(Get-Item $shell.CreateShortcut($lnk).TargetPath).VersionInfo.FileDescription + ".lnk") -WhatIf

Remove the -WhatIf at the end when using the script.

P. S. If you know Powershell, feel free to improve my answer.

Vinayak
  • 10,885
0

I also think your approach isn't feasible. The following batch/vbscript only gave me a small percentage of useful renames ( @Vinayak I'd apppend a -Whatif to the copy can't comment) The batch outputs rename commands you may redirect to a file like ´DoRenames.cmd`and after revision execute.

::ListLnkProps.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off&setlocal enabledelayedexpansion
:: create .\ListLnkProps.vbs
for /f "tokens=1 delims=:" %%A in (
  'findstr /I /N "##ListLnkProps" ^<"%~f0"') do set /A ln#=%%A - 1
more +%ln#% "%~f0" >"%~dpn0.vbs"

:: List.lnk file properties in curent folder and subfolders
for /f "delims=" %%A in (
  'dir /A-D /b /s *.lnk'
) do cscript //nologo "%~dpn0.vbs" "%%A"
goto :eof

' ##ListLnkProps.vbs
set WshShell = WScript.CreateObject("WScript.Shell")
File = WScript.Arguments.Unnamed(0)
set Lnk = WshShell.CreateShortcut(File)
NewName =  Lnk.Description & ".lnk"
If Len(Lnk.Description) > 8 Then
  wscript.Echo "Ren " & chr(34) & File & chr(34) & " " & _
                        chr(34) & NewName & chr(34) 
End If
set Lnk = Nothing

Edit appended sample output

> q:\test\2016-11\05\ListLnkProps.cmd
Ren "C:\Users\UserName\Desktop\Google Chrome.lnk" "Internetzugriff.lnk"
Ren "C:\Users\UserName\Desktop\On-Screen Keyboard.lnk" "Zeigt eine Tastatur an, die von einer Maus oder einem Umschalteingabegerät gesteuert wird..lnk"
Ren "C:\Users\UserName\Desktop\Programm_Links\Alarm.lnk" "Digital Alarm Clock.lnk"
Ren "C:\Users\UserName\Desktop\Programm_Links\Avira.lnk" "Avira starten.lnk"
Ren "C:\Users\UserName\Desktop\Programm_Links\Bitvise SSH Client.lnk" "Bitvise SSH Client L7.15 - a general-purpose SSH client: supports tunneling (manual and via integrated proxy), SFTP file transfer, bridging of FTP clients to SFTP, remote console access and remote administration of Bitvise SSH Server (WinSSHD)..lnk"
Ren "C:\Users\UserName\Desktop\Programm_Links\calibre - E-book management.lnk" "Manage your e-book collection and download news.lnk"
Ren "C:\Users\UserName\Desktop\Programm_Links\calibre 64bit - E-book management.lnk" "Manage your e-book collection and download news.lnk"
Ren "C:\Users\UserName\Desktop\Programm_Links\CDBurnerXP.lnk" "CDBunerXP.lnk"

HTH

LotPings
  • 7,391