welcome to 's blog...


公告

我的分类(专题)

日志更新

最新评论

留言板

链接

搜索


Blog信息




Converting VBScript Commands to Windows PowerShell Commands
aku1 发表于 2007-8-23 14:01:51

This guide is intended to help you “translate” VBScript scripts to Windows PowerShell scripts. However, this is not designed to be a word-for-word translation guide; for better or worse, things don’t quite work that way. Instead, consider this a reference as you begin writing Windows PowerShell scripts. After all, sooner or later you’re bound to run into a situation where you find yourself thinking, "OK, I need to use a Select Case statement here. I know how to do that in VBScript, but how do I do that in Windows PowerShell?” That’s where this guide can come in handy; it takes all the VBScript functions, statements, and operators and shows you, as much as possible, a Windows PowerShell equivalent.


Incidentally, we tried to find an equivalent for most of the commands in the VBScript Language Reference; however, we would never claim that we found the best equivalent for these commands. If you know of a better/faster/easier way to, say, format a number as currency in Windows PowerShell, please let us know. We’ll publish any alternate approaches as an addendum to this guide.


Download this conversion guide as a Word document (along with Windows PowerShell Week sample scripts).

VBScript Functions

• Abs
• Array
• Asc
• Atn
• CBool
• CByte
• CCur
• CDate
• CDbl
• Chr
• CInt
• CLng
• Cos
• CreateObject
• CSng
• CStr
• Date
• DateAdd
• DateDiff
• DatePart
• DateSerial
• DateValue
• Day
• Escape
• Eval
• Exp
• Filter
• Fix
• FormatCurrency
• FormatDateTime
• FormatNumber
• FormatPercent
• GetLocale
• GetObject
• GetRef
• Hex
• Hour
• InputBox
• InStr
• InStrRev
• Int
• IsArray
• IsDate
• IsEmpty
• IsNull
• IsNumeric
• IsObject
• Join
• LBound
• LCase
• Left
• Len
• LoadPicture
• Log
• LTrim
• Mid
• Minute
• Month
• MonthName
• MsgBox
• Now
• Oct
• Replace
• RGB
• Right
• Rnd
• Round
• RTrim
• ScriptEngine
• ScriptEngineBuildVersion
• ScriptEngineMajorVersion
• ScriptEngineMinorVersion
• Second
• SetLocale
• Sgn
• Sin
• Space
• Split
• Sqr
• StrComp
• String
• StrReverse
• Tan
• Time
• Timer
• TimeSerial
• TimeValue
• Trim
• TypeName
• UBound
• UCase
• Unescape
• VarType
• Weekday
• WeekdayName
• Year

VBScript Statements

• Call
• Class
• Const
• Dim
• Do...Loop
• Erase
• Execute
• ExecuteGlobal
• Exit
• For Each...Next
• For...Next
• Function
• If...Then...Else
• On Error
• Option Explicit
• Private
• Property Get
• Property Let
• Property Set
• Public
• Randomize
• ReDim
• Rem
• Select Case
• Set Statement
• Stop Statement
• Sub Statement
• While...Wend Statement
• With Statement

Err Object Properties and Methods

• Description Property
• HelpContext Property
• HelpFile Property
• Number Property
• Source Property
• Clear Method
• Raise Method

VBScript Operators

• Addition operator (+)
• And operator (AND)
• Assignment operator (=)
• Concatenation operator (&)
• Division operator (/)
• Eqv operator (Eqv)
• Exponentiation operator (^)
• Imp operator (Imp)
• Integer division operator (\)
• Is operator (Is)
• Mod operator (Mod)
• Multiplication operator (*)
• Not operator (Not)
• Or operator (OR)
• Subtraction operator (-)
• Xor operator (XOR)

阅读全文 | 回复(0) | 引用通告 | 编辑


发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题:



Powered by Oblog.