Advertisement
omegastripes

add_argument_to_shortcut.vbs

Jun 20th, 2014
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim sPath, sFixed, sSkipped, arrArgs
  2. If WScript.Arguments.Length = 0 Then
  3.     MsgBox "Перетащите на файл скрипта один или несколько ярлыков"
  4.     WScript.Quit
  5. Else
  6.     sFixed = ""
  7.     sSkipped = ""
  8.     For Each sPath In WScript.Arguments
  9.         If LCase(Right(sPath, 4)) = ".lnk" Then
  10.             With CreateObject("WScript.Shell").CreateShortcut(sPath)
  11.                 arrArgs = Split(.Arguments)
  12.                 Redim Preserve arrArgs(Ubound(arrArgs) + 1)
  13.                 arrArgs(Ubound(arrArgs)) = "--ignore-certificate-errors"
  14.                 .Arguments = Join(arrArgs)
  15.                 .Save
  16.             End With
  17.             sFixed = sFixed & sPath & vbCrLf
  18.         Else
  19.             sSkipped = sSkipped & sPath & vbCrLf
  20.         End If
  21.     Next
  22.     MsgBox "Исправлены: " & vbCrLf & vbCrLf & sFixed & vbCrLf & vbCrLf & "Пропущены: " & vbCrLf & vbCrLf & sSkipped
  23. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement