LoginSignup
1
2

More than 3 years have passed since last update.

Windowsでショートカットのリンク先のファイルを同じフォルダにコピーするスニペット

Last updated at Posted at 2018-11-29

1280px-Bleekman_zimmer.jpg

タイトルどおりのものです。

$WScript = New-Object -ComObject WScript.Shell
Get-ChildItem *.lnk | ForEach-Object -Process { 
    $src = $WScript.CreateShortcut($_.FullName).TargetPath;
    $dest = Split-Path $src -leaf;    
    Copy-Item -Path $src -Destination $dest;
}

大量の画像ファイルがあって、そのなかからいい画像を見繕ってアルバムを作りたいが、ショートカットで集めたら編集ソフトにドラッグアンドドロップで挿入できないぞ困った!と相談されたので書いたやつです。PowerShellよくわからないのでちょっと悩みました。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2