Overview Of The New Windows Scripting Host 5.6 - Example Scripts
(Page 6 of 7 )
The following are some example scripts which should allow you to get a feel how the WSH works. Just copy and paste them into Notepad and feel free to play around a bit with them.
Example 1:
'Example1.vbs
'Display WSH and script properties
Wscript.Echo Wscript.Application
Wscript.Echo Wscript.FullName
Wscript.Echo Wscript.Name
Wscript.Echo Wscript.Path
Wscript.Echo Wscript.ScriptFullName
Wscript.Echo Wscript.ScriptName
Wscript.Echo Wscript.Version
Example 2:
'Example2.vbs
'Adding a network drive and displaying system information
Set WshNetwork = Wscript.CreateObject("Wscript.Network")
'Print the computer name, user name, and domain
Wscript.Echo wshNetwork.ComputerName
Wscript.Echo WshNetwork.Username
Wscript.Echo WshNetwork.UserDomain
'Add a network drive
WshNetwork.MapNetWorkDrive "L:","\ServernameShare"
Next: Roll The Credits >>
More Windows Scripting Articles
More By Norbert Cartagena