VB Script find/Create exe shortcut

Lenovo Thinkpad x200 laptop computer wi...
May 4, 2010 at 08:39:17
Specs: Windows XP
I need help making a VB script file that searches program files for certain exe filenames and then create a shortcut of it,then place it on user desktop.

Thank you for all the help in advance.

See More: VB Script find/Create exe shortcut

Report •

May 4, 2010 at 08:42:15
certain exe filenames
Do I get to pick which exe filenames to shortcut, or do you want to provide a list?

Report •

May 4, 2010 at 09:07:11
certain.exe ?

Report •

May 4, 2010 at 17:11:46
If your system is like mine, "shortcut.vbs" is included in the samples. I suggest to search your system and see if it's there. it should then be easy to adapt it to your own needs.

If you don't find it, i can pmail it to you or post a version.

Report •

Related Solutions

May 4, 2010 at 18:57:18
Thanks for the reply,what i mean is to find a speific executeable file and than create a shorcut out of it to be place on the user desktop.The location of the executeable file is not known in which sub folder of C:\Program Files\Altiris\Altiris Agent\Software Delivery.

You can send me a pmail of the "shortcut.vbs" script,properly i can chage the script.

Once again thanks for the effort.

Report •

May 5, 2010 at 14:33:18
tvc: certain.exe ?
Sure, why not:
WScript.Quit Main

Function Main
  Set shell = CreateObject("WScript.Shell")
  exe = FindFile(CreateObject("Scripting.FileSystemObject"), _
   shell.ExpandEnvironmentStrings("%programFiles%\Altiris\Altiris Agent\Software Delivery\certain.EXE"))
  If exe = "" Then
    WScript.Echo "Error: File Not Found"
    Main = 53
    Exit Function
  End If
  With shell.CreateShortcut(shell.SpecialFolders("Desktop") & "\certain.lnk")
    .TargetPath = exe
    .WindowStyle = 1
    .IconLocation = exe & ", 0"
  End With
End Function

Function FindFile(fso, filePath) 'As string
  'Three ways to exit the function
  '1: File is in the supplied directory
  If fso.FileExists(filePath) Then
    FindFile = filePath
    Exit Function
  End If
  '2: File is in some child branch
  file = fso.GetFileName(filePath)
  path = fso.GetParentFolderName(filePath)
  For Each d In fso.GetFolder(path).SubFolders
    FindFile = FindFile(fso, d & "\" & file)
    If FindFile <> "" Then _
      Exit Function
  '3: File not found
  FindFile = ""
End Function

Report •

May 6, 2010 at 02:57:50
I thank you for the prompt reply and the script.It works very well.Thanks again.Just one last problem,i need to add the disk space to a script and below is the script for the disk space.Can the below script be use to check the local C drive free disk space of more than 2GB , the certain executeable will proceed to install,,if free disk space is less than 2GB,a prompt will need to reflect on screen "Pls ensure you have at least 2Gb of free hard disk space to proceed with the installation."

Once again thanks for the effort.Cheers.

Option Explicit

strLineDate = Date()
strLineTime = Time()

Dim oWsh, oWshSysEnv, objFSO, objWMIService
Dim oDrives, oDrive, objOutFile, colItems, objItem, objEmail
Dim strLineDate, strLineTime, strLineProcessorTime, strLineDriveSpace, strLinePercentCommittedBytesInUse

Set oWsh = WScript.CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")

'FREE SPACE Report Fetch
Set oDrives = objFSO.Drives
For Each oDrive In oDrives
Select Case oDrive.DriveType
Case 2 'Drives that are fixed
strLineDriveSpace = strLineDriveSpace & " " & oDrive.DriveLetter & "\: " & Round(oDrive.FreeSpace / (1024 * 1024)) & "MB free (" & Round(100 * (oDrive.FreeSpace / oDrive.TotalSize), 2) & " %) "
End Select

Report •

May 9, 2010 at 19:08:18
I'm not sure what you're asking for here. If you don't want the file to copy if the drive is too full, check Altiris Agent's manual. If you don't want the shortcut to work, you'd have to link the shortcut to another script, and have that script test the free space. If you don't want the script I provided to produce the shortcut, then that script will have to be modified.

Report •

Ask Question