''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
WScript.Echo "hello world. "
' show the content
Dim a,b,c
' set varibles
a=1
b=2
c=a+b
WScript.Echo c
' show the answer
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
' enforce us to set varibles before we use it.
Dim a,b
a=2
b=3
c=a+b
WScript.Echo c
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
' enforce us to set varibles before we use it.
Dim a,b,c
a="2nihao"
b="3"
c=a+b
WScript.Echo "c=",c,a,b
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'to change the type of varibles
sumA = 30:sumB=15
Test=CBool(sumA=sumB)
WScript.Echo Test
sumB=sumB*2
Test=CBool(sumA=sumB)
WScript.Echo Test
dateStr="December 10,2005"
theDate=CDate(dateStr)
WScript.Echo theDate
timeStr="8:25:10 AM"
theTime=CDate(timeStr)
WScript.Echo theTime
aDouble=715.234
bDouble=33.24
cDouble=aDouble+bDouble
WScript.Echo aDouble
WScript.Echo cDouble
aString =CStr(aDouble)
WScript.Echo aString
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'How to use Arrays in programming
Option Explicit
Dim bookArray(10)
bookArray(0)="A Tale of Two Cities"
bookArray(1)="Grapes of Wrath"
Wscript.Echo bookArray(0)
Wscript.Echo bookArray(1)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim bookArray()
'you can change the capacity of the Arrays again
reDim bookArray(5)
bookArray(0)="A Tale of Two Cities"
bookArray(1)="Grapes of Wrath"
Wscript.Echo bookArray(0)
Wscript.Echo bookArray(1)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' the operators in VBScirpt
answer=9Mod3
WScript.Echo answer
answer=9Mod2
WScript.Echo answer
answer=9^2
WScript.Echo answer
answer=-9*2
WScript.Echo answer
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' the operators in VBScirpt
answer=9 Mod 3
WScript.Echo answer
answer=9 Mod 2
WScript.Echo answer
answer=9^2
WScript.Echo answer
answer=-9*2
WScript.Echo answer
answer=-9+2*10
WScript.Echo answer
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
VBscript 中的语言基础
最新推荐文章于 2020-06-30 09:49:07 发布