Advertisement
metalx1000

Big Fish Games Desktop Short Cut Creator

Jun 22nd, 2014
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Creates direct links to Big Fish Games
  2. write-host "Searching for Games..."
  3. #get directories
  4. $folders = Get-ChildItem -Path "c:\program files" -recurse -include *.bfg| select Directory
  5.  
  6. #remove duplicates
  7. $folders = $folders|sort-object | Get-Unique -AsString
  8.  
  9. foreach($folder in $folders){
  10.     $f = $folder.Directory.FullName
  11.     $file = Get-ChildItem $f -force| Where-Object {$_.mode -match "h"}
  12.    
  13.     write-host "Creating desktop shortcut for $file"
  14.  
  15.     #create desktop shortcut
  16.     $WshShell = New-Object -comObject WScript.Shell
  17.     $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\$file.lnk")
  18.     $Shortcut.TargetPath = "$f\$file"
  19.     $Shortcut.WorkingDirectory = "$f\"
  20.     $Shortcut.Save()
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement