Thursday, January 3, 2019


What are different conditional statements in vbscript?

In Vbscript there are 2 types of conditional statements.

  1. if ...else
  2. Select Case
Example of if else - 


a = 10

If a > 10 Then
  Msgbox "a is greater than 10"
ElseIf a>0 then
  Msgbox "a is between 0 and 11"
Else
  Msgbox "a is not greater than 0"
End If




Example of select case - 


a = Inputbox("enter the number")


Select Case cint(a)

  Case 1  

     msgbox "You entered 1"

  Case 2
     msgbox "You entered 2"

  Case 3
     msgbox "You entered 3"

  Case else
     msgbox "You entered invalid input"

End Select



Related Posts:

  • How to terminate the process in vbscript How to terminate the process in vbscript Here is the vbscript  that will terminate or close all the processes with given nameIn below script I am closing internet explorer process.'Create a WMI objectstrComputer … Read More
  • What is Windows Script Host? What is Windows Script Host? WSH is a scripting host for Windows Script compatible scripting engines.WSH supports various scripting languages like vbscript, javascript, python etc.You can do below operations using WSH… Read More
  • What is WMI? What is WMI?  WMI and Win32 classes WMI stands for Windows Management Instrumentation. This is used to access system hardware and software features. It provides very powerful API to perform tasks like starting pr… Read More
  • How to create a word document using vbscript How to create a word document using vbscript ' Create and Save a Word Document'Create the Word objectSet objWord = CreateObject("Word.Application")'Set the caption of the WordobjWord.Caption = "Welcome to Automated Wo… Read More
  • How to get the IP Address of System in vbscript. How to get the IP Address of System in vbscript. Here is a program that can be run to get the IP address of system.'Get the WMI object for local computerstrComputer = "."Set objWMIService = GetObject("winmgmts:" _&nbs… Read More

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

152,031

Blog Archive