or by using PowerShell script:
$targetFolderPath = "C:\Users\Lenovo\AppData\Roaming\Microsoft\Windows\Recent"
# Create an array of shortcut names and target paths
$shortcuts = @{
"Shortcut1" = "C:\Path\to\Target1.exe"
"Shortcut2" = "C:\Path\to\Target2.exe"
"Shortcut3" = "C:\Path\to\Target3.exe"
}
# Loop through the shortcuts and create .lnk files
$shell = New-Object -ComObject WScript.Shell
foreach ($shortcut in $shortcuts.GetEnumerator()) {
$shortcutName = $shortcut.Key
$targetPath = $shortcut.Value
$shortcutFilePath = Join-Path -Path $targetFolderPath -ChildPath "$shortcutName.lnk"
$shortcutObject = $shell.CreateShortcut($shortcutFilePath)
$shortcutObject.TargetPath = $targetPath
$shortcutObject.Save()
Write-Host "Shortcut '$shortcutName' created at '$shortcutFilePath'"
}
Make sure to replace the values in the $targetFolderPath
variable with the actual path to the "Recent" folder, and update the $shortcuts
hashtable with the desired shortcut names and their corresponding target paths.
Save the script with a .ps1 extension (e.g., create-shortcuts.ps1
), and then you can run it by opening PowerShell and executing the script using the following command:
.\create-shortcuts.ps1
The script will iterate through the $shortcuts
hashtable, create a .lnk file for each shortcut name and target path, and save it in the specified folder. It will also display a message for each created shortcut with its name and file path.