1. Home
  2. Computing & Technology
  3. Visual Basic

VBScript - The System Administrator's Language - Part 1

By Dan Mabbutt, About.com

5 of 6

The Example Code

~~~~~~~~~~~~~~~~~~~~~~~~~
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop _
  & "\MyExcel.lnk")
oShellLink.TargetPath = _
  "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+F"
oShellLink.IconLocation = _
  "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE, 0"
oShellLink.Description = "My Excel Shortcut"
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save
~~~~~~~~~~~~~~~~~~~~~~~~~

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB 6
  5. Learn VBScript
  6. VBScript - The System Administrator's Language - Part 1

©2009 About.com, a part of The New York Times Company.

All rights reserved.