Ветеран
Сообщения: 27449
Благодарности: 8087
|
Профиль
|
Отправить PM
| Цитировать
Цитата angel_lyucifer:
у меня есть файл Vlp.exe у него может быть любая директория, но мне нужно создать ярлык скриптом, этот скрипт будет лежать рядом с файлом... »
|
Так:
читать дальше »
Код: ![Выделить весь код](images/misc/selectcode.png)
Option Explicit
Dim strFileName
Dim objFSO
Dim strPath2File
Dim objFile
strFileName = "Vlp.exe"
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
strPath2File = objFSO.BuildPath(objFSO.GetParentFolderName(WScript.ScriptFullName), strFileName)
If objFSO.FileExists(strPath2File) Then
Set objFile = objFSO.GetFile(strPath2File)
With WScript.CreateObject("WScript.Shell")
With .CreateShortcut(objFSO.BuildPath(.SpecialFolders.Item("Desktop"), objFSO.GetBaseName(strFileName) & ".lnk"))
.TargetPath = objFile.Path
.WorkingDirectory = objFile.ParentFolder.Path
.Save
End With
End With
Set objFile = Nothing
Else
WScript.Echo "File [" & strPath2File & "] not found near this script."
WScript.Quit 1
End If
Set objFSO = Nothing
WScript.Quit 0
|
Отправлено: 03:19, 18-12-2013
| #5
|