none
Скрипт поиска ярлыка на рабочем столе через URL(замена URL) RRS feed

Ответы

  • Я в своё время писал нечто подобное:

    oTargetOld = "\\Server01\TechExpert\texpert.exe"
    oTargetNew = "\\Server02\Kodeks\kodeks.exe"
    oWorkingDirectory  =  ""
    oProductDesc = "ИС Кодекс: Связь"

    If oTargetOld = "" Then WScript.Quit 0
    If oTargetNew = "" Then WScript.Quit 0

    Set oShell = WScript.CreateObject ("WScript.Shell")
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

    sDesktopPath = oShell.SpecialFolders("Desktop")
    SearchShortcut sDesktopPath
    SearchSubFolders oFSO.GetFolder(sDesktopPath)
     
    sProgramsPath = oShell.SpecialFolders("Programs")
    SearchShortcut sProgramsPath
    SearchSubFolders oFSO.GetFolder(sProgramsPath)


    Sub SearchSubFolders(Folder)
        For Each Subfolder in Folder.SubFolders
            SearchShortcut Subfolder.Path
            SearchSubFolders Subfolder
        Next
    End Sub


    Sub SearchShortcut(Folder)
       Set objDIR = oFSO.GetFolder(Folder)
     
       For Each oFile in objDIR.Files
            fEXT = oFSO.GetExtensionName(oFile.Path)
            If LCase(fEXT) = LCase("lnk") Then
                   Set oShortcut = oShell.CreateShortcut(oFile)
                   If LCase(oShortcut.TargetPath) = LCase(oTargetOld) Then
                          oShortcut.TargetPath = oTargetNew
                          oShortcut.Description = oProductDesc
                          oShortcut.IconLocation=oTargetNew & ",0"
    '                      If Not oWorkingDirectory = "" Then oShortcut.WorkingDirectory = oWorkingDirectory
                          oShortcut.WorkingDirectory = oWorkingDirectory
                          oShortcut.Save
                   End If
            End If
       Next
    End Sub

     

    • Помечено в качестве ответа GriFoN87 18 января 2012 г. 10:47
    18 января 2012 г. 8:14

Все ответы

  • Я в своё время писал нечто подобное:

    oTargetOld = "\\Server01\TechExpert\texpert.exe"
    oTargetNew = "\\Server02\Kodeks\kodeks.exe"
    oWorkingDirectory  =  ""
    oProductDesc = "ИС Кодекс: Связь"

    If oTargetOld = "" Then WScript.Quit 0
    If oTargetNew = "" Then WScript.Quit 0

    Set oShell = WScript.CreateObject ("WScript.Shell")
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

    sDesktopPath = oShell.SpecialFolders("Desktop")
    SearchShortcut sDesktopPath
    SearchSubFolders oFSO.GetFolder(sDesktopPath)
     
    sProgramsPath = oShell.SpecialFolders("Programs")
    SearchShortcut sProgramsPath
    SearchSubFolders oFSO.GetFolder(sProgramsPath)


    Sub SearchSubFolders(Folder)
        For Each Subfolder in Folder.SubFolders
            SearchShortcut Subfolder.Path
            SearchSubFolders Subfolder
        Next
    End Sub


    Sub SearchShortcut(Folder)
       Set objDIR = oFSO.GetFolder(Folder)
     
       For Each oFile in objDIR.Files
            fEXT = oFSO.GetExtensionName(oFile.Path)
            If LCase(fEXT) = LCase("lnk") Then
                   Set oShortcut = oShell.CreateShortcut(oFile)
                   If LCase(oShortcut.TargetPath) = LCase(oTargetOld) Then
                          oShortcut.TargetPath = oTargetNew
                          oShortcut.Description = oProductDesc
                          oShortcut.IconLocation=oTargetNew & ",0"
    '                      If Not oWorkingDirectory = "" Then oShortcut.WorkingDirectory = oWorkingDirectory
                          oShortcut.WorkingDirectory = oWorkingDirectory
                          oShortcut.Save
                   End If
            End If
       Next
    End Sub

     

    • Помечено в качестве ответа GriFoN87 18 января 2012 г. 10:47
    18 января 2012 г. 8:14
  • Спасибо большое. Все получилось!!!
    18 января 2012 г. 10:47