Home | Careers | IT Counseling | IT Jobs | IT Resources

 

 

 
About Us | Advertise | Feedback | Contact Us | Bookmark this page now|
Have any doubts regarding how to Search IT Training Courses?...Click here for Quick Search Tips Search IT Courses
Have any doubts regarding Keyword Search?...Click here for Quick Search Tips keyword
Have any doubts regarding Institutes Search?...Click here for Quick Search Tips institutes
Have any doubts regarding Specialization Search?...Click here for Quick Search Tips specialization
Have any doubts regarding Fees Search?...Click here for Quick Search Tips fees
to
Have any doubts regarding Duration Search?...Click here for Quick Search Tips duration

IT dart Tips

Which IT course ?

Venture Capital

Online Education

Exams Required for US of A

Overview of Admission Process

Test Preparation

Financial Aid

TOEFEL Examination

Cool Interview Tips

Skill Check

Resume

GRE Examination

GMAT Examination


IT dart News Letter
Get ITdart.com weekly headlines before it's published on our site! Subscribe and receive the articles delivered to your inbox!

Batch files using VB Script

Windows Scripting Host is a new component available with Windows 98, Windows NT SP4 and is also downloadable from the Microsoft site. This allows you to write very powerful batch files using VBScript .VBS files.

Along with this functionality, a new object is made available for programming. The base object is called Wscript.wshshell. This object provides extensive functionality required for managing shell, network, registry management functions. Here is a sample that can be used to create a desktop icon using Windows Shell Script.

' This sample demonstrates how to use the WSHShell
' object to create a shortcut on the desktop.
Dim WSHShell
Set WSHShell = _
WScript.CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
' Read desktop path using WshSpecialFolders object
DesktopPath = WSHShell.SpecialFolders("Desktop")
' Create a shortcut object on the desktop
Set MyShortcut = _
WSHShell.CreateShortcut(DesktopPath & _
"\Shortcut to notepad.lnk")
' Set shortcut object properties and save it
MyShortcut.TargetPath = _
WSHShell.ExpandEnvironmentStrings _
("%windir%\notepad.exe")
MyShortcut.WorkingDirectory = _
WSHShell.ExpandEnvironmentStrings("%windir%")
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = _
WSHShell.ExpandEnvironmentStrings _
("%windir%\notepad.exe, 0")
MyShortcut.Save
Here are some important methods of this wshshell object.

Method
Description

CreateShortcut
Creates a WshShortcut object and returns it

ExpandEnvironmentStrings
Expands a PROCESS environment variable and returns the result string

Popup
Pops up a message box window containing a specified message

RegDelete
Deletes, from the registry, a specified key or value

RegRead
Returns a specified key or value from the registry

RegWrite
Sets a specified key or value in the registry

Run
Creates a new process that executes a specified command with a specified window style

Here are the details of the WshShortcut object.

Property
Description

Arguments
Parameters to a shortcut object

Description
A description of a shortcut object

Hotkey
The hotkey of a shortcut object

IconLocation
The icon location of a shortcut object

TargetPath
The target path of a shortcut object

WindowStyle
The window style of a shortcut object

WorkingDirectory
The working directory of a shortcut object

Save is the only method for this object.

The .VBS files can be simply run as Batch files.

The WScript object has the following methods:

Method
Description

CreateObject
Creates an object and establishes its event handling

DisconnectObject
Disconnects a previously connected object from Windows Scripting Host

Echo
Displays parameters in window or at a command prompt in a command prompt window

GetObject
Retrieves an Automation object from a file

Quit
Quits execution with a specified error code

The script can accept command line arguments like the batch files. The Arguments property of WScript exposes these parameters.

This code will display all parameters passed on a command line:

' Display all command-line parameters
Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
WScript.Echo objArgs(I)

One Click Courses

Advanced Certiflcate in Java Application Development

Advanced Cisco Router Conflguration

Advanced Course in Object Oriented Programming (Coop)

C#

C# with ASP.Net

CAD/ CAM

Certfication in Unix, C, C++ (CUCC)

Certificate in Advanced System Programming

Certificate in Java & E-commerce (CJEC)

EI -Strategiest

Object Oriented Developer and Designer

Specialization in 3D Graphics & Animation

Wap@Asset


Firewalls: What To Block

Windows System Architecture (WSA)

Operating System (OS)

Data Access Technologies

Functional menu-level blocking

Data Access Methodologies

ODBC Architecture

Learn Java from the ground up

Internet Security

The Day I Learnt JavaScript



ITdart Updates:
Computer Security | Computer Services | CRM | Database | E Commerce | Graphic & Design | Internet | Java | Knowledge Management | Linux | Online Marketing | Open Source | Operating System | Robotics | Semi Conductors | Software Downloads | Virus Info | WAP & 3G | Web Development | XML and Metadata
Home | Careers | IT Counseling | IT Jobs | IT Resources

© Copyright 1999-2000 ITdart.com. All rights reserved.
All brands are Trade Marks of Respective owners. Disclaimer    Legal    Privacy Policy