[[windows_wiki:vbscript_-_icon_copy]]

VBScript - Icon Copy

General Information

Script template to copy an external icon for use in a shortcut.

Checklist

  • OS: Windows XP/7

file copy_icon.vbs
'==========================================================================
' VBScript:  AUTHOR: <name> <date>
' NAME: <Template-ExtIcon.vbs>
' DESCRIPTION: Copies an External Icon to C:\ if it does not already exist. 
'==========================================================================
 
'Declare Variables for later use
Option Explicit
Const OverwriteExisting = TRUE
Dim IconName
Dim CopyFrom
Dim CopyTo
Dim objIcon
 
'++++++++++++++++++++++++ EDIT THESE VARIABLES +++++++++++++++++++++++++++++
 
'Filename of Icon (include extension)
IconName = "Name.ico"
 
'Full network path of folder icon is in. (include trailing slash)
CopyFrom = "\\server\folder\"
 
'Full local directory to copy the icon to
CopyTo = "C:\"
 
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
Set objIcon = CreateObject("Scripting.FileSystemObject")
 
If objIcon.FileExists(CopyTo & IconName) Then
  Wscript.Quit
Else
  ObjIcon.CopyFile CopyFrom & IconName , CopyTo, OverwriteExisting
End If
  • windows_wiki/vbscript_-_icon_copy.txt
  • Last modified: 2019/05/26 03:50
  • (external edit)