TipZone
  BugAlert
  Downloads
 How Tos
 Win98
 Books
 HealthyPC
 Linux
 and more

PC Magazine

  PC Tech

The Windows Scripting Host

Introduction

Active Scripting

The Windows Scripting Host Object Model

The WshShell and WshNetwork Objects

Putting It Together

Figure 1: Mapping Network Drives

Figure 2: Creating URL Shortcuts



X10.com - The SuperSite for Home Automation!

Axis Communications

 
  Categories:
Scripting Languages
Windows 95/NT
Operating Systems
The Windows Scripting Host
FIGURE 2

Continued from Figure 1: Mapping Network Drives

This script reads URLs from a text file and creates URL shortcuts on the desktop.

Dim WshShell, WshUrlShortcut
Dim fs, listFile
Dim urlString, nameString, desktopFolder

Set fs = WScript.CreateObject(" Scripting.FileSystemObject")
Set listFile = fs.OpenTextFile("c:\wsh\url.txt")

Set WshShell = WScript.CreateObject("WScript.Shell")

desktopFolder = WshShell.SpecialFolders("Desktop")

Do While listFile.AtEndOfStream <> True
nameString = listFile.ReadLine
urlString = listFile.ReadLine

Set WshUrlShortcut = WshShell.CreateShortcut(desktopFolder &
"\" & nameString & ".url")
WshUrlShortcut.TargetPath = urlString
WshUrlShortcut.Save

Loop

listFile.Close

Published as Operating Systems in the 02/10/98 issue of PC Magazine.


 SPONSORED LINKS
@Backup   Your Solid Online Backup Plan. Download Now.
Services   9c/MINUTE LONG DISTANCE, 5c/MINUTE ON SUNDAYS!
STORAGE   Quantum means non-stop business, 24 hours a day
Software   X10.com -- The SuperSite for Home Automation
Books   Bargain Books up to 90% off at barnesandnoble.com
 ZDNET FEATURED LINKS
Downloads   Check out the best new downloads in Reviewer's Raves
Bargains!   Shop the Basement for best buys on computer products
Free Help   Got computing questions? ZDHelp has all the answers!
 MAGAZINE OFFERS
Free Offer   Get a FREE SUBSCRIPTION to Inter@ctive Week

TOP
Copyright (c) 1998 Ziff-Davis Inc.