Changing Shortcut Paths found in the Display Folder Structure
  • 05 Oct 2023
  • PDF

Changing Shortcut Paths found in the Display Folder Structure

  • PDF

The content is currently unavailable in Ja - 日本語. You are viewing the default English version.
記事の要約

There are times when you may need to move your display folder to another machine. Most often when upgrade PARCView or the PARCView server. When moving the display folder shortcuts to other files in the display folder are not updated to match the new pathing. This means they will still point to the older servers display folders after an upgrade. If you are heavily relying on shortcuts the easiest way to update the Shortcut links is with a PowerShell script like below.


OldShortcutPath = This is the existing pathing you want to replace.

NewShortcutPath = This is the new pathing you want to replace the OldShortcutPath with.

CurrentDisplayFolderPath = This is the folder structure that will be search for shortcuts.



$oldPrefix = "OldShortcutPath"

$newPrefix = "NewShortcutPath"

$searchPath = "CurrentDisplayFolderPath"


$shell = new-object -com wscript.shell

write-host "Updating shortcut target" -foregroundcolor red -backgroundcolor black


dir $searchPath -filter *.lnk -recurse | foreach {

$lnk = $shell.createShortcut( $_.fullname )

$oldPath= $lnk.targetPath

$lnkRegex = "^" + [regex]::escape( $oldPrefix )


if ( $oldPath -match $lnkRegex ) {

$newPath = $oldPath -replace $lnkRegex, $newPrefix


write-host "Found: " + $_.fullname -foregroundcolor yellow -backgroundcolor black

write-host " Replace: " + $oldPath

write-host " With: " + $newPath

$lnk.targetPath = $newPath

$lnk.Save()

}

}


この記事は役に立ちましたか?