Advertisement
Guest User

Untitled

a guest
Mar 18th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Text file containing the files names, full file name, one file name per line:
  2. $inputFile = "C:\Users\Piotr\Desktop\Bzdety\skroty\linki.txt"
  3. #full directory name where to create the shortcuts:
  4. $targetDirectory = "C:\Users\Piotr\Desktop\Bzdety\skroty\"
  5.  
  6. foreach($line in Get-Content $inputFile)
  7. {
  8.   $filename = [System.IO.Path]::GetFileName($line); #get file name without directory
  9.   #create shortcut
  10.   $s=(New-Object -COM WScript.Shell).CreateShortcut($targetDirectory + $filename.replace("?"," ") + '.lnk');
  11.   $s.TargetPath = $line;
  12.   $s.Save();
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement