- 29 Aug 2025
- 印刷する
- PDF
表示フォルダ構造にあるショートカットパスの変更
- 更新日 29 Aug 2025
- 印刷する
- PDF
表示フォルダーを別のマシンに移動する必要がある場合があります。ほとんどの場合、PARCView または PARCView サーバーをアップグレードするときです。表示フォルダを移動すると、表示フォルダ内の他のファイルへのショートカットが新しいパスに合わせて更新されません。これは、アップグレード後も古いサーバーの表示フォルダーを指すことを意味します。ショートカットに大きく依存している場合、ショートカット リンクを更新する最も簡単な方法は、次のような PowerShell スクリプトを使用することです。
OldShortcutPath = これは、置き換える既存のパスです。
NewShortcutPath = これは、OldShortcutPath を置き換える新しいパスです。
CurrentDisplayFolderPath = これは、ショートカットを検索するフォルダー構造です。
$oldPrefix = "古いショートカットパス"
$newPrefix = "新しいショートカットパス"
$searchPath = "CurrentDisplayFolderPath"
$shell = 新しいオブジェクト -com wscript.shell
write-host "ショートカットターゲットの更新" -foregroundcolor 赤 -backgroundcolor 黒
dir $searchPath -filter *.lnk -recurse |foreach {
$lnk = $shell.createShortcut( $_.fullname )
$oldPath= $lnk.targetPath
$lnkRegex = "^" + [正規表現]::escape( $oldPrefix )
if ( $oldPath -match $lnkRegex ) {
$newPath = $oldPath -置換$lnkRegex、$newPrefix
write-host "見つかりました: " + $_.fullname -foregroundcolor yellow -backgroundcolor black
write-host " 置換: " + $oldPath
write-host " と: " + $newPath
$lnk.targetPath = $newPath
$lnk。保存()
}
}