Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Скриптовые языки администрирования Windows (http://forum.oszone.net/forumdisplay.php?f=102)
-   -   [решено] Quick Launch (http://forum.oszone.net/showthread.php?t=242275)

gen0m.rsw 08-09-2012 23:14 1985335

Quick Launch
 
Такая вот проблема
Есть скрипт для создания ярлыка QuickLaunch.vbs

Set WshShell = WScript.CreateObject("WScript.Shell")
Set oShellLink = WshShell.CreateShortcut("C:\Documents and Settings\Admin\Application Data\Microsoft\Internet Explorer\Quick Launch\RegWorkshop.lnk")
oShellLink.TargetPath = "D:\RSWP\REGEDIT\RegWorkshop\RegWorkshop.exe"
oShellLink.IconLocation = "D:\RSWP\REGEDIT\RegWorkshop\RegWorkshop.exe, 0"
oShellLink.WorkingDirectory = "%SystemRoot%\system32"
oShellLink.Save

Хотелось бы что имя пользователя Admin определялось само (у всех же разные)
И имя диска D: тоже определялось автоматически, при условии что сам скрипт находиться в X:\RSWP\,
а папка RSWP всегда в корне диска, даже бывает на двух и более!

Iska 09-09-2012 01:25 1985390

Цитата:

Цитата gen0m.rsw
а папка RSWP всегда в корне диска, даже бывает на двух и более! »

Поясните.

gen0m.rsw 09-09-2012 10:02 1985450

Цитата:

Цитата Iska
Поясните. »

Папка RSWP находиться на hdd , и на usb носителе, что бы периодически синхронизировать, но ярлыки нужны только для hdd!!!

Iska 09-09-2012 13:45 1985504

gen0m.rsw, пробуйте:
читать дальше »
Код:

Option Explicit

Dim objDrive
Dim strPath


With WScript.CreateObject("Scripting.FileSystemObject")
        For Each objDrive In .Drives
                If objDrive.DriveType = 2 Then
                        strPath = .BuildPath(objDrive.RootFolder.Path, "RSWP\REGEDIT\RegWorkshop\RegWorkshop.exe")
                       
                        If .FileExists(strPath) Then
                                With WScript.CreateObject("WScript.Shell")
                                        With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & "\Microsoft\Internet Explorer\Quick Launch\RegWorkshop.lnk")
                                                .TargetPath      = strPath
                                                .IconLocation    = strPath & ", 0"
                                                .WorkingDirectory = "%SystemRoot%\system32"
                                               
                                                .Save
                                        End With
                                End With
                               
                                Exit For
                        End If
                End If
        Next
End With

WScript.Quit 0


gen0m.rsw 09-09-2012 14:35 1985522

Цитата:

Цитата Iska
gen0m.rsw, пробуйте: »

Дублировал ваш скрипт для второго ярлыка, вписал пути и значения, выдал ошибку, дело в том что ярлык не один , если можно то по подробней!?

Option Explicit

Dim objDrive
Dim strPath


With WScript.CreateObject("Scripting.FileSystemObject")
For Each objDrive In .Drives
If objDrive.DriveType = 2 Then
strPath = .BuildPath(objDrive.RootFolder.Path, "RSWP\REGEDIT\RegWorkshop\RegWorkshop.exe")

If .FileExists(strPath) Then
With WScript.CreateObject("WScript.Shell")
With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & "\Microsoft\Internet Explorer\Quick Launch\RegWorkshop.lnk")
.TargetPath = strPath
.IconLocation = strPath & ", 0"
.WorkingDirectory = "%SystemRoot%\system32"

.Save
End With
End With

Exit For
End If
End If
Next
End With

WScript.Quit 0



With WScript.CreateObject("Scripting.FileSystemObject")
For Each objDrive In .Drives
If objDrive.DriveType = 2 Then
strPath = .BuildPath(objDrive.RootFolder.Path, "RSWP\REGEDIT\Regshot\_Regshot.exe")

If .FileExists(strPath) Then
With WScript.CreateObject("WScript.Shell")
With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & "\Microsoft\Internet Explorer\Quick Launch\Regshot.lnk")
.TargetPath = strPath
.IconLocation = strPath & ", 0"
.WorkingDirectory = "%SystemRoot%\system32"

.Save
End With
End With

Exit For
End If
End If
Next
End With

WScript.Quit 0


Цитата:

Цитата Iska
gen0m.rsw, пробуйте: »

Мне по проще, дублировать определённые секции, и редактировать пути!!!

Iska,
Цитата:

Цитата Iska
gen0m.rsw, пробуйте: »

С одним ярлыком прошло!!!!

Iska 09-09-2012 16:35 1985572

Цитата:

Цитата gen0m.rsw
Option Explicit
Dim objDrive
Dim strPath
»

gen0m.rsw, код на форуме оформляется тэгом [code].

Цитата:

Цитата gen0m.rsw
выдал ошибку, »

Принято выкладывать точное сообщение об ошибке. Обычно достаточно нажать «Ctrl-C» в окне с сообщением об ошибке.

Цитата:

Цитата gen0m.rsw
Мне по проще, дублировать определённые секции, и редактировать пути!!! »

Пробуйте (не проверялось):
читать дальше »
Код:

Option Explicit

Dim objDictionary
Dim elem

Dim strPath
Dim objDrive


Set objDictionary = WScript.CreateObject("Scripting.Dictionary")

With objDictionary
        .Add "RSWP\REGEDIT\RegWorkshop\RegWorkshop.exe", "RegWorkshop.lnk"
        .Add "RSWP\REGEDIT\Regshot\_Regshot.exe",        "Regshot.lnk"
       
        For Each elem In .Keys
                With WScript.CreateObject("Scripting.FileSystemObject")
                        For Each objDrive In .Drives
                                If objDrive.DriveType = 2 Then
                                        strPath = .BuildPath(objDrive.RootFolder.Path, elem)
                                       
                                        If .FileExists(strPath) Then
                                                With WScript.CreateObject("WScript.Shell")
                                                        With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & _
                                                                "\Microsoft\Internet Explorer\Quick Launch\" & objDictionary.Item(elem))
                                                               
                                                                .TargetPath      = strPath
                                                                .IconLocation    = strPath & ", 0"
                                                                .WorkingDirectory = "%SystemRoot%\system32"
                                                               
                                                                .Save
                                                        End With
                                                End With
                                               
                                                Exit For
                                        End If
                                End If
                        Next
                End With
        Next
       
        .RemoveAll
End With

Set objDictionary = Nothing

WScript.Quit 0


gen0m.rsw 10-09-2012 04:29 1985919

Цитата:

Цитата Iska
gen0m.rsw, код на форуме оформляется тэгом [code]. »

Сам хотел спросить, как енто писать!!!

gen0m.rsw 14-08-2014 17:31 2389286

Iska

Всем респект!!!
Спасибо за код(добавление ярлыков в быстры запуск), намного облегчил проблему.
читать дальше »
Код:

Option Explicit

Dim objDictionary
Dim elem

Dim strPath
Dim objDrive


Set objDictionary = WScript.CreateObject("Scripting.Dictionary")

With objDictionary
    .Add "RSWP\FILE_FOLDERS\BCompare\BCompare.exe",          "Beyond Compare 3.lnk"
    .Add "RSWP\MANAGER\NirSoft\NirSoft\shexview.exe",        "ShellExView.lnk"
    .Add "RSWP\MANAGER\NirSoft\NirSoft\shmnview.exe",        "ShellMenuView.lnk"
    .Add "RSWP\MANAGER\PROWiSe\PROWiSe.exe",                  "PROWiSe.lnk"
    .Add "RSWP\MANAGER\Pserv2\Pserv2.exe",                    "Pserv2.lnk"
    .Add "RSWP\MANAGER\Starter\Starter.exe",                  "Starter.lnk"
    .Add "RSWP\MANAGER\SysInternals\AutoRuns.exe",            "AutoRuns.lnk"
    .Add "RSWP\MANAGER\Total_Commander\Totalcmd.exe",        "Total Commander.lnk"
    .Add "RSWP\REGEDIT\Regshot\Regshot.exe",                  "Regshot.lnk"
    .Add "RSWP\REGEDIT\RegWorkshop\RegWorkshop.exe",          "RegWorkshop.lnk"
    .Add "RSWP\REGEDIT\SysTracer_Pro\SysTracer.exe",          "SysTracer.lnk"
    .Add "RSWP\UNINSTALL\UninstallTool\UninstallTool.exe",    "UninstallTool.lnk"
    .Add "RSWP\UPROVLENIE\RestartExplorer.exe",              "Restart Explorer.lnk"
   
    For Each elem In .Keys
        With WScript.CreateObject("Scripting.FileSystemObject")
            For Each objDrive In .Drives
                If objDrive.DriveType = 2 Then
                    strPath = .BuildPath(objDrive.RootFolder.Path, elem)
                   
                    If .FileExists(strPath) Then
                        With WScript.CreateObject("WScript.Shell")
                            With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & _
                                "\Microsoft\Internet Explorer\Quick Launch\" & objDictionary.Item(elem))
                               
                                .TargetPath      = strPath
                                .IconLocation    = strPath & ", 0"
                                .WorkingDirectory = "%SystemRoot%\system32"
                               
                                .Save
                            End With
                        End With
                       
                        Exit For
                    End If
                End If
            Next
        End With
    Next
   
    .RemoveAll
End With


Нельзя ли енто чуть чуть усовершенствовать, что-бы на рабочий стол ярлыки можно было выводить!!
Сам данный скрипт всегда находиться в папке RSWP, а сама папка(RSWP), всегда в корне диска, не обязательно на одном(у меня и на харде и на флэше)!!!!
Заранее спасибо

Iska 16-08-2014 20:09 2390189

Цитата:

Цитата gen0m.rsw
что-бы на рабочий стол ярлыки можно было выводить!! »

Замените:
Код:

With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & _
        "\Microsoft\Internet Explorer\Quick Launch\" & objDictionary.Item(elem))

на:
Код:

With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:Desktop").Self.Path & "\" & objDictionary.Item(elem))

gen0m.rsw 18-08-2014 12:02 2390685

Iska
Цитата:

Цитата Iska
Замените:
Код: »

Ярлыки добавляются на десктоп, но хотелось бы реализовать одном скрипте!!!!

Iska 18-08-2014 13:59 2390738

Цитата:

Цитата gen0m.rsw
рлыки добавляются на десктоп, но хотелось бы реализовать одном скрипте!!!! »

Продублируйте код:
Код:

                            With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & _
                                "\Microsoft\Internet Explorer\Quick Launch\" & objDictionary.Item(elem))
                               
                                .TargetPath      = strPath
                                .IconLocation    = strPath & ", 0"
                                .WorkingDirectory = "%SystemRoot%\system32"
                               
                                .Save
                            End With

и сделайте замену строки во втором дубле.

gen0m.rsw 19-08-2014 11:59 2391160

Цитата:

Цитата Iska
Продублируйте код: »

Забыл сказать то, ярлыки для десктопа другие, а не те что для QuickLaunch прописаны!!!!

Iska 19-08-2014 13:04 2391184

Цитата:

Цитата gen0m.rsw
Забыл сказать то, ярлыки для десктопа другие, а не те что для QuickLaunch прописаны!!!! »

Продублируйте весь кусок кода:
Код:

With objDictionary

End With

Замените во втором:
Код:

        .Add "RSWP\REGEDIT\RegWorkshop\RegWorkshop.exe", "RegWorkshop.lnk"
        .Add "RSWP\REGEDIT\Regshot\_Regshot.exe",        "Regshot.lnk"

на потребное. Там же замените:
Код:

With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & _
        "\Microsoft\Internet Explorer\Quick Launch\" & objDictionary.Item(elem))

на:
Код:

With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:Desktop").Self.Path & "\" & objDictionary.Item(elem))

gen0m.rsw 20-08-2014 15:56 2391790

Iska , все ОК!!! Респект!!!

gen0m.rsw 27-03-2016 15:56 2620342

Iska, прошу Вашей помощи!
Возникла необходимость добавления ярлыков(тоже разных) в папку "Автозагрузка"в Ентот скрипт, условия теже
все проги из той же папки, далее код
My VBS Full(точнее Ваш)

' ----- ExeScript Options Begin -----
' ScriptType: window,invoker
' DestDirectory: temp
' Icon: D:\RSWP\_AUTORUN\mainicon.ico
' OutputFile: D:\RSWP\add_quick_launch.exe
' ----- ExeScript Options End -----
Option Explicit

Dim objDictionary
Dim elem

Dim strPath
Dim objDrive


Set objDictionary = WScript.CreateObject("Scripting.Dictionary")

' Добавление ярлыков в "Быстрый запуск"
With objDictionary
.Add "RSWP\FILE_FOLDERS\Beyond_Compare\BCompare.exe", "Beyond Compare 3.lnk"
.Add "RSWP\FILE_FOLDERS\Locate32\locate32.exe", "Locate32.lnk"
.Add "RSWP\HDD_UTILITES\BOOTICE\BOOTICEx86_ru.exe", "BootIce.lnk"
.Add "RSWP\MANAGER\NirSoft\NirSoft\shexview.exe", "ShellExView.lnk"
.Add "RSWP\MANAGER\PROWiSe\PROWiSe.exe", "PROWiSe.lnk"
.Add "RSWP\MANAGER\Pserv2\Pserv2.exe", "Pserv2.lnk"
.Add "RSWP\MANAGER\Starter\Starter.exe", "Starter.lnk"
.Add "RSWP\MANAGER\SysInternals\AutoRuns.exe", "AutoRuns.lnk"
.Add "RSWP\MANAGER\SysInternals\ProcExp.exe", "Process Explorer.lnk"
.Add "RSWP\MANAGER\SysTracer\SysTracer.exe", "SysTracer.lnk"
.Add "RSWP\MANAGER\SysTracer_Pro\SysTracer.exe", "SysTracer Pro.lnk"
.Add "RSWP\MANAGER\Total_Commander\Totalcmd.exe", "Total Commander.lnk"
.Add "RSWP\MULTIMEDIA\1by1\1by1.exe", "1by1.lnk"
.Add "RSWP\REGEDIT\Registry_Workshop\RegWorkshop.exe", "RegWorkshop.lnk"
.Add "RSWP\REGEDIT\Regshot\Regshot.exe", "RegShot.lnk"
.Add "RSWP\UNINSTALL\UNINSTALL_TOOL\UninstallTool.exe", "Uninstall Tool.lnk"
.Add "RSWP\HDD_UTILITES\QEMUBOOTTESTER\QemuBootTester.exe", "QemuBootTester.lnk"


For Each elem In .Keys
With WScript.CreateObject("Scripting.FileSystemObject")
For Each objDrive In .Drives
If objDrive.DriveType = 2 Then
strPath = .BuildPath(objDrive.RootFolder.Path, elem)

If .FileExists(strPath) Then
With WScript.CreateObject("WScript.Shell")
With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:AppData").Self.Path & _
"\Microsoft\Internet Explorer\Quick Launch\" & objDictionary.Item(elem))

.TargetPath = strPath
.IconLocation = strPath & ", 0"
.WorkingDirectory = "%SystemRoot%\system32"

.Save
End With
End With

Exit For
End If
End If
Next
End With
Next

.RemoveAll
End With


' Добавление ярлыков на "Рабочий стол"
With objDictionary
' .Add "RSWP\CD-DVD\UltraISO\UltraISO.exe", "UltraISO.lnk"
' .Add "RSWP\FILE_FOLDERS\Directory_Monitor\DirectoryMonitor.exe", "Directory Monitor.lnk"
' .Add "RSWP\MANAGER\Total_Commander\Totalcmd.exe", "Total Commander.lnk"

For Each elem In .Keys
With WScript.CreateObject("Scripting.FileSystemObject")
For Each objDrive In .Drives
If objDrive.DriveType = 2 Then
strPath = .BuildPath(objDrive.RootFolder.Path, elem)

If .FileExists(strPath) Then
With WScript.CreateObject("WScript.Shell")
With .CreateShortcut(WScript.CreateObject("Shell.Application").NameSpace("shell:Desktop").Self.Path & "\" & objDictionary.Item(elem))

.TargetPath = strPath
.IconLocation = strPath & ", 0"
.WorkingDirectory = "%SystemRoot%\system32"

.Save
End With
End With

Exit For
End If
End If
Next
End With
Next

.RemoveAll
End With




Set objDictionary = Nothing

WScript.Quit 0


Заранее спасибо!
С уважением gen0m.rsw


Время: 11:52.

Время: 11:52.
© OSzone.net 2001-